|
@@ -1,6 +1,4 @@
|
|
|
-// TODO implement edit/delete funcs
|
|
|
|
|
-//
|
|
|
|
|
-// TODO implement attempt to auto load issues folder if no arg specified
|
|
|
|
|
|
|
+// TODO implement edit/delete functions
|
|
|
package main
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
@@ -16,30 +14,46 @@ func main() {
|
|
|
flag.Parse()
|
|
flag.Parse()
|
|
|
arg := flag.Args()
|
|
arg := flag.Args()
|
|
|
|
|
|
|
|
|
|
+ var path string
|
|
|
if len(arg) == 0 {
|
|
if len(arg) == 0 {
|
|
|
- fmt.Println("Not enough arguments:", arg)
|
|
|
|
|
- os.Exit(1)
|
|
|
|
|
|
|
+ _, err := os.Stat("issues")
|
|
|
|
|
+ if err == nil {
|
|
|
|
|
+ if issues.IsIssueCollection("issues") {
|
|
|
|
|
+ path = "issues"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ fmt.Println("Could not load issues directory...")
|
|
|
|
|
+ os.Exit(1)
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ fmt.Println("Not enough arguments:", arg)
|
|
|
|
|
+ os.Exit(1)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if len(path) == 0 {
|
|
|
|
|
+ path = arg[0]
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if len(arg) > 1 {
|
|
if len(arg) > 1 {
|
|
|
fmt.Println("Too many arguments:", arg)
|
|
fmt.Println("Too many arguments:", arg)
|
|
|
os.Exit(1)
|
|
os.Exit(1)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- fileInfo, err := os.Stat(arg[0])
|
|
|
|
|
|
|
+ fileInfo, err := os.Stat(path)
|
|
|
if err == nil { // file exists
|
|
if err == nil { // file exists
|
|
|
if fileInfo.IsDir() { // file is dir
|
|
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])
|
|
|
|
|
|
|
+ if !issues.IsIssueCollection(path) && !issues.IsIssue(path) { // file is not issue collection and not issue
|
|
|
|
|
+ fmt.Printf("%s is a directory...\n", path)
|
|
|
os.Exit(1)
|
|
os.Exit(1)
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- fmt.Printf("%s is an existing file...\n", arg[0])
|
|
|
|
|
|
|
+ fmt.Printf("%s is an existing file...\n", path)
|
|
|
os.Exit(1)
|
|
os.Exit(1)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
p := tea.NewProgram(
|
|
p := tea.NewProgram(
|
|
|
- issues.Model{Path: arg[0]},
|
|
|
|
|
|
|
+ issues.Model{Path: path},
|
|
|
tea.WithAltScreen(), // use the full size of the terminal in its "alternate screen buffer"
|
|
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
|
|
// tea.WithMouseCellMotion(), // turn on mouse support so we can track the mouse wheel
|
|
|
)
|
|
)
|