CMD-options: OptionParser#on support "--abc STR". implemented for CMD#opt, too.
This commit is contained in:
parent
ba922fe52c
commit
8fe78bb406
|
@ -167,15 +167,15 @@ class DenCli::CMD
|
||||||
|
|
||||||
def parse_opt_string opt
|
def parse_opt_string opt
|
||||||
case opt
|
case opt
|
||||||
when /\A(--\[no-\][^=]+)\z/
|
when /\A(--\[no-\][^= ]+)\z/
|
||||||
@long, @val = $1, nil
|
@long, @val = $1, nil
|
||||||
when /\A(--[^=]+)=(.+)\z/
|
when /\A(--[^= ]+)[= ](.+)\z/
|
||||||
@long, @val = $1, $2 || @val
|
@long, @val = $1, $2 || @val
|
||||||
when /\A(--[^=]+)\z/
|
when /\A(--[^= ]+)\z/
|
||||||
@long, @val = $1, nil
|
@long, @val = $1, nil
|
||||||
when /\A(-[^=-])=?(.+)\z/
|
when /\A(-[^= -])[= ]?(.+)\z/
|
||||||
@short, @val = $1, $2 || @val
|
@short, @val = $1, $2 || @val
|
||||||
when /\A(-[^=-])\z/
|
when /\A(-[^= -])\z/
|
||||||
@short, @val = $1, nil
|
@short, @val = $1, nil
|
||||||
else
|
else
|
||||||
raise ArgumentError, "Unexpected format for option: #{opt.inspect}"
|
raise ArgumentError, "Unexpected format for option: #{opt.inspect}"
|
||||||
|
|
Loading…
Reference in a new issue