From e9771c4ca736d4a9c6a52ff662666c98470ea258 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Thu, 26 Mar 2020 22:00:16 -0500 Subject: [PATCH] add short flags --- cmd/ls.go | 3 ++- cmd/toggle.go | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/ls.go b/cmd/ls.go index 5889583..f94eee1 100644 --- a/cmd/ls.go +++ b/cmd/ls.go @@ -14,7 +14,8 @@ var ( func init() { fs := flag.NewFlagSet("toggle", flag.ExitOnError) - fs.String("selector", "all", "Set the selector") + selector := fs.String("selector", "all", "Set the selector") + fs.StringVar(selector, "s", "all", "Set the selector") RegisterCommand("ls", Command{ Func: LsCmd, diff --git a/cmd/toggle.go b/cmd/toggle.go index 950fb19..ba0be80 100644 --- a/cmd/toggle.go +++ b/cmd/toggle.go @@ -9,8 +9,10 @@ import ( func init() { fs := flag.NewFlagSet("toggle", flag.ExitOnError) - fs.Float64("duration", 1.0, "Set the duration") - fs.String("selector", "all", "Set the selector") + 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{ Func: ToggleCmd,