-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
45 lines (36 loc) · 1.12 KB
/
config.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
package main
import (
"flag"
"time"
)
const (
version = "1.1"
timeout = time.Second
)
var (
openBrowser bool
serverPort int
serverDisable bool
serialPort string
serialBitrate int
serialEnumerate bool
language Language
csvOutput bool
duration time.Duration
)
func ParseFlags() {
flag.BoolVar(&openBrowser, "o", false, "open the live display in a browser")
flag.IntVar(&serverPort, "s", 0, "choose a static port number over a free port")
flag.BoolVar(&serverDisable, "n", false, "disable the HTTP server")
flag.StringVar(&serialPort, "p", "", "name or path of the serial port")
flag.IntVar(&serialBitrate, "b", 2400, "override the default serial port bitrate")
flag.BoolVar(&serialEnumerate, "e", false, "enumerate all serial ports then exit")
l := flag.String("l", "en", "language for CSV and display (en,de,pt,fr)")
flag.BoolVar(&csvOutput, "c", false, "enable CSV output on standard output")
flag.DurationVar(&duration, "d", 0, "set an acquisition duration instead of endless")
flag.Parse()
language = LanguageEnglish
if _, ok := Translations[Language(*l)]; ok {
language = Language(*l)
}
}