Fix #5773
This commit is contained in:
parent
80db167abb
commit
928becece4
@ -35,9 +35,15 @@ func (self *Command) parse_args(ctx *Context, args []string) error {
|
|||||||
ambi := make([]string, len(possible_options))
|
ambi := make([]string, len(possible_options))
|
||||||
for i, o := range possible_options {
|
for i, o := range possible_options {
|
||||||
ambi[i] = o.MatchingAlias(NormalizeOptionName(opt_str), !strings.HasPrefix(opt_str, "--"))
|
ambi[i] = o.MatchingAlias(NormalizeOptionName(opt_str), !strings.HasPrefix(opt_str, "--"))
|
||||||
|
if ambi[i] == opt_str {
|
||||||
|
opt = o
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if opt == nil {
|
||||||
return &ParseError{Message: fmt.Sprintf("Ambiguous option: :yellow:`%s` could be any of: %s", opt_str, strings.Join(ambi, ", "))}
|
return &ParseError{Message: fmt.Sprintf("Ambiguous option: :yellow:`%s` could be any of: %s", opt_str, strings.Join(ambi, ", "))}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
opt.seen_option = opt_str
|
opt.seen_option = opt_str
|
||||||
needs_arg := opt.needs_argument()
|
needs_arg := opt.needs_argument()
|
||||||
if needs_arg && val_not_allowed {
|
if needs_arg && val_not_allowed {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user