forked from timeglass/glass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
65 lines (55 loc) · 1.78 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
package main
import (
"fmt"
"os"
"github.com/timeglass/glass/_vendor/github.com/codegangsta/cli"
"github.com/timeglass/glass/command"
)
type Command interface {
Name() string
Description() string
Usage() string
Run(c *cli.Context) error
Action() func(ctx *cli.Context)
Flags() []cli.Flag
}
var Version = "0.0.0"
var Build = "gobuild"
func main() {
app := cli.NewApp()
app.Author = "Ad van der Veer"
app.Email = "[email protected]"
app.Name = "Timeglass"
app.Usage = "Automated time tracking for code repositories"
app.Version = fmt.Sprintf("%s (%s)", Version, Build)
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "silent,s",
Usage: "supress all output over Stderr",
},
}
cmds := []Command{
command.NewInstall(), //install daemon and start service
command.NewUninstall(), //stop daemon and uninstall service
command.NewInit(), //write hooks, create timer and pull time data
command.NewStart(), //create timer for current directory, start measuring
command.NewPause(), //pause timer for the current directory, restart on file activity
command.NewStatus(), //fetch info of the timer for the current directory
command.NewReset(), //reset the timer to 0s
command.NewStop(), //remove timer for current directory, discarding meaurement
command.NewPush(), //push notes branch to remote
command.NewPull(), //pull notes branch from remote
command.NewPunch(), //persist time measurement to current HEAD commit
command.NewSum(), //sum total time of each commit given
}
for _, c := range cmds {
app.Commands = append(app.Commands, cli.Command{
Name: c.Name(),
Usage: c.Usage(),
Action: c.Action(),
Description: c.Description(),
Flags: c.Flags(),
})
}
app.Run(os.Args)
}