-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
48 lines (41 loc) · 1023 Bytes
/
main.go
File metadata and controls
48 lines (41 loc) · 1023 Bytes
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
package main
import (
"os"
"github.com/boltdb/bolt"
)
func main() {
// Create a new connection manager to manage the db instance
mgr, err := newBoltManager()
check(err)
defer mgr.Close()
// initialize buckets
mgr.Database().Update(func(tx *bolt.Tx) error {
tx.CreateBucketIfNotExists(TASKS_BUCKET)
tx.CreateBucketIfNotExists(ARCHIVE_BUCKET)
return nil
})
// create sub commands
osOut := os.Stdout
addCmd := newAddCmd(mgr, osOut)
doCmd := newDoCmd(mgr, osOut)
updateCmd := newUpdateCmd(mgr, osOut)
listCmd := newListCmd(mgr, osOut)
finishCmd := newFinishCmd(mgr, osOut)
clearCmd := newClearCmd(mgr, osOut)
archiveCmd := newArchiveCmd(mgr, osOut)
deleteCmd := newDeleteCmd(mgr, osOut)
statsCmd := newStatsCmd(mgr, osOut)
countCmd := newCountCmd(mgr, osOut)
tagsCmd := newTagsCmd(mgr, osOut)
// add sub commands
rootCmd.AddCommand(
addCmd, doCmd,
updateCmd, listCmd,
finishCmd, clearCmd,
archiveCmd, deleteCmd,
countCmd, tagsCmd,
statsCmd,
)
// initialize cobra
Execute()
}