-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (35 loc) · 992 Bytes
/
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
// A simple time logging program.
package main
import (
"fmt"
"os"
"github.com/fgahr/tilo/client"
_ "github.com/fgahr/tilo/command/abort"
_ "github.com/fgahr/tilo/command/current"
_ "github.com/fgahr/tilo/command/help"
_ "github.com/fgahr/tilo/command/listen"
_ "github.com/fgahr/tilo/command/ping"
_ "github.com/fgahr/tilo/command/query"
_ "github.com/fgahr/tilo/command/recent"
_ "github.com/fgahr/tilo/command/resume"
_ "github.com/fgahr/tilo/command/shutdown"
_ "github.com/fgahr/tilo/command/srvcmd"
_ "github.com/fgahr/tilo/command/start"
_ "github.com/fgahr/tilo/command/stop"
"github.com/fgahr/tilo/config"
_ "github.com/fgahr/tilo/server/backend/sqlite3"
)
// Initiate server or client operation based on given arguments.
func main() {
args := os.Args[1:]
conf, restArgs, err := config.GetConfig(args, os.Environ())
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
if client.Dispatch(conf, restArgs) {
os.Exit(0)
} else {
os.Exit(1)
}
}