return boolean options set
This commit is contained in:
1 parent
56e644e16e
commit
056257b8f5
2 files changed
+36
-4
No files matched your search
+22
-4
@@ -17,11 +17,29 @@ module Yawpa
|
||||
i = 0
|
||||
while i < params.length
|
||||
param = params[i]
|
||||
if param[0] != '-'
|
||||
args << params[i]
|
||||
if param =~ /^(-+)(.+)$/
|
||||
case $1.length
|
||||
when 2
|
||||
param_key = if options[$2]
|
||||
$2
|
||||
elsif options[$2.to_sym]
|
||||
$2.to_sym
|
||||
else
|
||||
nil
|
||||
end
|
||||
if param_key.nil?
|
||||
raise UnknownOptionException.new("Unknown option '#{param}'")
|
||||
end
|
||||
opt_config = options[param_key]
|
||||
nargs = opt_config[:nargs] || 0
|
||||
if nargs == 0
|
||||
opts[param_key] = true
|
||||
elsif nargs.class == FixNum
|
||||
elsif nargs.class == Range
|
||||
end
|
||||
end
|
||||
else
|
||||
opt_config = options[param] || options[param.to_sym]
|
||||
raise UnknownOptionException.new("Unknown option '#{param}'") if opt_config.nil?
|
||||
args << params[i]
|
||||
end
|
||||
i += 1
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user