| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- // TODO implement edit/delete funcs
- //
- // TODO implement attempt to auto load issues folder if no arg specified
- package main
- import (
- "flag"
- "fmt"
- "issues"
- "os"
- tea "github.com/charmbracelet/bubbletea"
- )
- func main() {
- flag.Parse()
- arg := flag.Args()
- if len(arg) == 0 {
- fmt.Println("Not enough arguments:", arg)
- os.Exit(1)
- }
- if len(arg) > 1 {
- fmt.Println("Too many arguments:", arg)
- os.Exit(1)
- }
- fileInfo, err := os.Stat(arg[0])
- if err == nil { // file exists
- if fileInfo.IsDir() { // file is dir
- if !issues.IsIssueCollection(arg[0]) && !issues.IsIssue(arg[0]) { // file is not issue collection and not issue
- fmt.Printf("%s is a directory...\n", arg[0])
- os.Exit(1)
- }
- }
- }
- p := tea.NewProgram(
- issues.Model{Path: arg[0]},
- tea.WithAltScreen(), // use the full size of the terminal in its "alternate screen buffer"
- // tea.WithMouseCellMotion(), // turn on mouse support so we can track the mouse wheel
- )
- if _, e := p.Run(); e != nil {
- fmt.Println("could not run program:", err)
- os.Exit(1)
- }
- }
|