add short flags

This commit is contained in:
Ryan Cavicchioni 2020-03-26 22:00:16 -05:00
parent 917053f39c
commit e9771c4ca7
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
2 changed files with 6 additions and 3 deletions

View File

@ -14,7 +14,8 @@ var (
func init() { func init() {
fs := flag.NewFlagSet("toggle", flag.ExitOnError) 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{ RegisterCommand("ls", Command{
Func: LsCmd, Func: LsCmd,

View File

@ -9,8 +9,10 @@ import (
func init() { func init() {
fs := flag.NewFlagSet("toggle", flag.ExitOnError) fs := flag.NewFlagSet("toggle", flag.ExitOnError)
fs.Float64("duration", 1.0, "Set the duration") duration := fs.Float64("duration", 1.0, "Set the duration")
fs.String("selector", "all", "Set the selector") 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("toggle", Command{
Func: ToggleCmd, Func: ToggleCmd,