-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflags.go
135 lines (121 loc) · 3.42 KB
/
flags.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package main
import (
"github.com/urfave/cli/v2"
)
const (
flagSource = "source" // serial, file, demo
flagSerialPort = "serial-port" // serial port name
flagHttpPort = "http-port" // http port number
flagLogFile = "log-file" // log file path
flagLogFrom = "log-from" // log from datetime: YYYY/MM/DD HH:mm:SS.SSSSSS
flagLogSocket = "log-socket" // log socket messages
flagDemoSpeed = "demo-speed" // avg events per minute
flagLocale = "locale"
flagSpeakCommand = "speak"
flagSpeakLives = "speak-lives"
flagSpeakCheers = "speak-cheers"
flagScoreHit = "score-hit"
flagScoreDamage = "score-damage"
flagAutoStart = "auto-start"
flagDurationBattle = "duration-battle"
flagDurationCountdown = "duration-countdown"
)
const (
defaultLogFilePath = "fpvc-lady.log"
)
func getFlags() []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: flagSource,
Usage: "Source of CSP messages: serial, log, demo.",
Required: false,
Value: "serial",
},
&cli.StringFlag{
Name: flagSerialPort,
Usage: "Port name where HC12 is connected to; by default the system will try find the port automatically.",
Required: false,
Value: "auto",
},
&cli.IntFlag{
Name: flagHttpPort,
Usage: "HTTP server port number",
Value: 8080,
},
&cli.StringFlag{
Name: flagLogFile,
Usage: "Path to the log file: save events to (when --source=serial) or read events from (when --source=log).",
Required: false,
Value: defaultLogFilePath,
},
&cli.StringFlag{
Name: flagLogSocket,
Usage: "File path to log web socket communication.",
Required: false,
Value: "",
},
&cli.StringFlag{
Name: flagLogFrom,
Usage: "Datetime to start read events from. Format: YYYY/MM/DD[ HH:mm:SS[.SSSSSS]]",
Required: false,
Value: "",
},
&cli.IntFlag{
Name: flagDemoSpeed,
Usage: "Number of hits, in average, per minute",
Value: 10, // 10 is good speed for demo to end soon and all phrases to be spoken; 20 simulates very intence combat, speaker may have to drop phrases
},
&cli.StringFlag{
Name: flagLocale,
Usage: "Locale to use: de, en, ru, etc.",
Required: false,
Value: "en",
},
&cli.StringFlag{
Name: flagSpeakCommand,
Usage: "Text-to-speech command: system, google, none or any other command to convert text to speech.",
Required: false,
Value: "system",
},
&cli.BoolFlag{
Name: flagSpeakLives,
Usage: "Speak lives.",
Required: false,
Value: false,
},
&cli.BoolFlag{
Name: flagSpeakCheers,
Usage: "Speak cheers.",
Required: false,
Value: false,
},
&cli.StringFlag{
Name: flagScoreHit,
Usage: "How much a hit is worth. Fomat: [minID[-maxID]:]score,...",
Required: false,
Value: "A1-E9:3,F1-FF:1", // A-E are players, F is a static target
},
&cli.StringFlag{
Name: flagScoreDamage,
Usage: "How much damage costs you. Fomat: [minID[-maxID]:]score,...",
Required: false,
Value: "-1",
},
&cli.BoolFlag{
Name: flagAutoStart,
Usage: "Start the battle automatically upon first hit.",
Required: false,
Value: true,
},
&cli.IntFlag{
Name: flagDurationBattle,
Usage: "Duration of the battle phase, minutes; 0 means no limit",
Value: 0,
},
&cli.IntFlag{
Name: flagDurationCountdown,
Usage: "Duration of the countdown phase, seconds; 0 means no countdown",
Value: 0,
},
}
}