store CLI defaults into variables

This commit is contained in:
2020-03-28 15:22:34 -05:00
parent 676eabb0cb
commit 67cd97e2d8
5 changed files with 48 additions and 34 deletions

View File

@ -9,10 +9,12 @@ func init() {
var cmdName string = "set-state"
fs := flag.NewFlagSet(cmdName, flag.ExitOnError)
duration := fs.Float64("duration", 1.0, "Set the duration")
fs.Float64Var(duration, "d", 1.0, "Set the duration")
selector := fs.String("selector", "all", "Set the selector")
fs.StringVar(selector, "s", "all", "Set the selector")
duration := fs.Float64("duration", defaultDuration, "Set the duration")
fs.Float64Var(duration, "d", defaultDuration, "Set the duration")
selector := fs.String("selector", defaultSelector, "Set the selector")
fs.StringVar(selector, "s", defaultSelector, "Set the selector")
RegisterCommand(cmdName, Command{
Func: ToggleCmd,