mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-27 03:42:49 +00:00
Allow explicitly setting boolean options in Go cli parser
Matches C parser
This commit is contained in:
parent
39bf612071
commit
d7fb143ee0
4 changed files with 45 additions and 12 deletions
|
|
@ -55,7 +55,13 @@ func (self *Command) parse_args(ctx *Context, args []string) error {
|
|||
}
|
||||
if has_val {
|
||||
if !needs_arg {
|
||||
return &ParseError{Message: fmt.Sprintf("The option: :yellow:`%s` does not take values", opt_str)}
|
||||
if opt.OptionType == BoolOption {
|
||||
if err := opt.add_value(opt_val); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return &ParseError{Message: fmt.Sprintf("The option: :yellow:`%s` does not take values", opt_str)}
|
||||
}
|
||||
}
|
||||
return opt.add_value(opt_val)
|
||||
} else if needs_arg {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue