next : consistent default case handling across subcmds
This commit is contained in:
parent
b5075786c6
commit
0ff9e6d9a3
2 changed files with 3 additions and 4 deletions
|
|
@ -32,11 +32,11 @@ func parseArgs(args []string) options {
|
||||||
opts.Descriptor.Val = arg
|
opts.Descriptor.Val = arg
|
||||||
case i == 1 && !flags.HasDashPrefix(arg):
|
case i == 1 && !flags.HasDashPrefix(arg):
|
||||||
opts.Tags.Val = arg
|
opts.Tags.Val = arg
|
||||||
case i >= 2:
|
|
||||||
log.Printf("um next: too many args: %s", args)
|
|
||||||
flags.Help("next", opts)
|
|
||||||
case arg == opts.Help.Long || arg == opts.Help.Short:
|
case arg == opts.Help.Long || arg == opts.Help.Short:
|
||||||
flags.Help("next", opts)
|
flags.Help("next", opts)
|
||||||
|
default:
|
||||||
|
log.Printf("um next: invalid argument: %s", arg)
|
||||||
|
flags.Help("next", opts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return opts
|
return opts
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ func initOpts() options {
|
||||||
|
|
||||||
func parseArgs(args []string) options {
|
func parseArgs(args []string) options {
|
||||||
opts := initOpts()
|
opts := initOpts()
|
||||||
|
|
||||||
for i := 0; i < len(args); i++ {
|
for i := 0; i < len(args); i++ {
|
||||||
arg := args[i]
|
arg := args[i]
|
||||||
switch {
|
switch {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue