-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
45 lines (42 loc) · 749 Bytes
/
Copy pathmain.go
File metadata and controls
45 lines (42 loc) · 749 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
package main
import (
"fmt"
"os"
"strings"
)
const version = "0.1.0"
func main() {
args := os.Args[1:]
cmd := "run"
if len(args) > 0 && !strings.HasPrefix(args[0], "-") {
cmd = args[0]
args = args[1:]
}
switch cmd {
case "run":
cmdRun(args)
case "stats":
cmdStats()
case "apps":
cmdApps(args)
case "app":
cmdApp(args)
case "spikes":
cmdSpikes(args)
case "log":
iface, rest := extractFlag(args, "-i")
interval, _ := extractFlag(rest, "--interval")
iv := 5.0
if interval != "" {
fmt.Sscanf(interval, "%f", &iv)
}
runLogger(iface, iv)
case "config":
cmdConfig(args)
case "version", "--version", "-v":
fmt.Println("datasip", version)
default:
fmt.Println("unknown command:", cmd)
os.Exit(1)
}
}