return option value for short option also

This commit is contained in:
josh committed 2013-01-22 14:03:27 -05:00
1 parent cf049aed2f
commit 90d2a938d5
2 files changed
+18 -3

No files matched your search

+8 -3
View File
@@ -39,9 +39,6 @@ module Yawpa
raise InvalidArgumentsException.new("Not enough arguments supplied for option '#{param_key}'")
end
end
if opts[param_key].length == 1
opts[param_key] = opts[param_key].first
end
end
elsif param =~ /^-(.+)$/
short_flags = $1
@@ -76,6 +73,14 @@ module Yawpa
end
i += 1
end
# Condense 1-element arrays of option values to just the element itself
opts.each_key do |k|
if opts[k].class == Array and opts[k].length == 1
opts[k] = opts[k].first
end
end
return [opts, args]
end