tag : one blank switch block
This commit is contained in:
parent
c7c48eab43
commit
6a5304da2c
1 changed files with 6 additions and 10 deletions
16
tag/tag.go
16
tag/tag.go
|
|
@ -24,23 +24,19 @@ func InitOpts() options {
|
||||||
|
|
||||||
func ParseArgs(args []string) options {
|
func ParseArgs(args []string) options {
|
||||||
opts := InitOpts()
|
opts := InitOpts()
|
||||||
if len(args) == 0 {
|
|
||||||
return opts
|
|
||||||
}
|
|
||||||
if !flags.HasDashPrefix(args[0]) {
|
|
||||||
opts.Query.Val = args[0]
|
|
||||||
}
|
|
||||||
for i, arg := range args {
|
for i, arg := range args {
|
||||||
switch arg {
|
switch {
|
||||||
case opts.Invert.Long, opts.Invert.Short:
|
case i == 0 && !flags.HasDashPrefix(arg):
|
||||||
|
opts.Query.Val = arg
|
||||||
|
case arg == opts.Invert.Long || arg == opts.Invert.Short:
|
||||||
opts.Invert.Val = true
|
opts.Invert.Val = true
|
||||||
case opts.Date.Long, opts.Date.Short:
|
case arg == opts.Date.Long || arg == opts.Date.Short:
|
||||||
if flags.MissingValueArg(args, i) {
|
if flags.MissingValueArg(args, i) {
|
||||||
flags.HelpMissingVal(arg)
|
flags.HelpMissingVal(arg)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
opts.Date.Val = args[i+1]
|
opts.Date.Val = args[i+1]
|
||||||
case opts.Help.Long, opts.Help.Short:
|
case arg == opts.Help.Long || arg == opts.Help.Short:
|
||||||
flags.Help("tag", opts)
|
flags.Help("tag", opts)
|
||||||
return opts
|
return opts
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue