lib/args_parser/styles/default.rb in args_parser-0.0.6 vs lib/args_parser/styles/default.rb in args_parser-0.0.7

- old
+ new

@@ -2,21 +2,22 @@ module ArgsParser class Parser def parse_style_default(argv) k = nil + is_key = /^-+([^-\s]+)$/ argv.each_with_index do |arg, index| unless k - if arg =~ /^-+[^-\s]+$/ - k = arg.scan(/^-+([^-\s]+)$/)[0][0].strip.to_sym + if arg =~ is_key + k = arg.scan(is_key)[0][0].strip.to_sym k = aliases[k] if aliases[k] - elsif index == 0 - @first = arg + else + self.argv.push arg end else - if arg =~ /^-+[^-\s]+$/ + if arg =~ is_key params[k][:value] = true - k = arg.scan(/^-+([^-\s]+)$/)[0][0].strip.to_sym + k = arg.scan(is_key)[0][0].strip.to_sym k = aliases[k] if aliases[k] else params[k][:value] = arg k = nil end