From 77c320d2a8720310a81d5782abfd338f7f27fc2a Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Fri, 27 Mar 2020 19:53:11 -0500 Subject: [PATCH] use variables --- cmd/ls.go | 5 +++-- cmd/toggle.go | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/ls.go b/cmd/ls.go index 1485a90..be3ffd9 100644 --- a/cmd/ls.go +++ b/cmd/ls.go @@ -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, }) diff --git a/cmd/toggle.go b/cmd/toggle.go index c441b93..ef7e940 100644 --- a/cmd/toggle.go +++ b/cmd/toggle.go @@ -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, })