-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
52 lines (42 loc) · 864 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
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"flag"
"fmt"
"log"
"os"
"virunus.com/linux-csgo-mute/app"
"virunus.com/linux-csgo-mute/config"
)
func main() {
testPtr := flag.Bool("t", false, "Print the current config and exit")
writePtr := flag.Bool("C", false, "Write the current config to disk and exit, creating or overwriting the config file as needed")
debugFlag := flag.Bool("d", false, "Print debug info")
flag.Parse()
if flag.NFlag() > 1 {
log.Print("Too many flags")
os.Exit(1)
}
// test config
if *testPtr {
c := config.New()
str, err := c.GetConfig()
if err != nil {
log.Fatal(err)
}
fmt.Println(string(str))
os.Exit(0)
}
// write config
if *writePtr {
c := config.New()
if err := c.WriteFile(); err != nil {
log.Fatal(err)
}
os.Exit(0)
}
// run app
err := app.Start(*debugFlag)
if err != nil {
log.Fatal(err)
}
}