diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/un.rb | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -43,8 +43,11 @@ def setup(options = "", *long_options) end end long_options.each do |s| - opt_name = s[/\A(?:--)?([^\s=]+)/, 1].intern - o.on(s.gsub(/([a-z])([A-Z])/){$1+"-"+$2.downcase}.sub(/\A(?!--)/, '--')) do |val| + opt_name, arg_name = s.split(/(?=[\s=])/, 2) + opt_name.sub!(/\A--/, '') + s = "--#{opt_name.gsub(/([A-Za-z]+)([A-Z])/, '\1-\2').downcase}#{arg_name}" + opt_name = opt_name.intern + o.on(s) do |val| opt_hash[opt_name] = val end end |