use variables
This commit is contained in:
parent
4ea3545ea7
commit
77c320d2a8
@ -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,
|
||||
})
|
||||
|
@ -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,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user