use variables

This commit is contained in:
Ryan Cavicchioni 2020-03-27 19:53:11 -05:00
parent 4ea3545ea7
commit 77c320d2a8
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
2 changed files with 7 additions and 4 deletions

View File

@ -10,11 +10,12 @@ var (
)
func init() {
fs := flag.NewFlagSet("toggle", flag.ExitOnError)
var cmdName string = "ls"
fs := flag.NewFlagSet(cmdName, flag.ExitOnError)
selector := fs.String("selector", "all", "Set the selector")
fs.StringVar(selector, "s", "all", "Set the selector")
RegisterCommand("ls", Command{
RegisterCommand(cmdName, Command{
Func: LsCmd,
Flags: fs,
})

View File

@ -6,13 +6,15 @@ import (
)
func init() {
fs := flag.NewFlagSet("toggle", flag.ExitOnError)
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")
RegisterCommand("toggle", Command{
RegisterCommand(cmdName, Command{
Func: ToggleCmd,
Flags: fs,
})