forked from driusan/bug
/
main.go
68 lines (63 loc) · 1.28 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package main
import (
"fmt"
"os"
//"regex"
"github.com/driusan/bug/bugs"
)
func getEditor() string {
editor := os.Getenv("EDITOR")
if editor != "" {
return editor
}
return "vim"
}
func main() {
app := BugApplication{}
if bugs.GetRootDir() == "" {
fmt.Printf("Could not find issues directory.\n")
fmt.Printf("Make sure either the PMIT environment variable is set, or a parent directory of your working directory has an issues folder.\n")
fmt.Printf("Aborting.\n")
os.Exit(2)
}
if len(os.Args) > 1 {
switch os.Args[1] {
case "add", "new", "create":
app.Create(os.Args[2:])
case "view", "list":
app.List(os.Args[2:])
case "priority":
app.Priority(os.Args[2:])
case "status":
app.Status(os.Args[2:])
case "milestone":
app.Milestone(os.Args[2:])
case "tag":
app.Tag(os.Args[2:])
case "mv", "rename", "retitle", "relabel":
app.Relabel(os.Args[2:])
case "purge":
app.Purge()
case "rm", "close":
app.Close(os.Args[2:])
case "edit":
app.Edit(os.Args[2:])
case "--version", "version":
app.Version()
case "env":
app.Env()
case "dir", "pwd":
app.Pwd()
case "commit":
app.Commit()
case "roadmap":
app.Roadmap(os.Args[2:])
case "help":
fallthrough
default:
app.Help(os.Args[1:]...)
}
} else {
app.Help()
}
}