-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
35 lines (31 loc) · 1.09 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
package main
import (
"log"
"os"
"github.com/tobstarr/wlcli/Godeps/_workspace/src/github.com/dynport/dgtk/cli"
)
func main() {
l := log.New(os.Stderr, "", 0)
router := cli.NewRouter()
c, _ := loadCurrentConfig()
if c != nil && c.ListID > 0 {
router.Register("push", &pushAction{listID: c.ListID}, "Push a task to the current list")
router.Register("list", &listInboxAction{listID: c.ListID}, "List current list")
router.Register("edit", &edit{listID: c.ListID}, "Edit list")
} else {
router.Register("edit", &edit{}, "Edit list")
}
router.Register("inbox/list", &listInboxAction{}, "List Inbox")
router.Register("inbox/push", &pushAction{}, "Push a task to inbox")
router.Register("init", &initAction{}, "Initialize "+configFileName+" config file")
router.Register("lists/list", &listLists{}, "List Lists")
router.Register("tasks/complete", &completeTasks{}, "Complete Tasks")
router.Register("tasks/delete", &deleteTasks{}, "Delete Tasks")
switch err := router.RunWithArgs(); err {
case nil, cli.ErrorHelpRequested, cli.ErrorNoRoute:
// ignore
return
default:
l.Fatal(err)
}
}