Sha256: 8bbbec3620ab507451ca396e1d015a5c4fa1eccb5469e26fc9c5b430dc68d284
Contents?: true
Size: 671 Bytes
Versions: 1
Compression:
Stored size: 671 Bytes
Contents
module ArgsParser class Parser def parse_style_equal(argv) on_validate_error do |err, name, value| STDERR.puts "Error: #{err.message} (--#{name}=#{value})" exit 1 end is_option = /^-+([^-=\s]+)$/ is_param = /^-+([^-=\s]+)=(.+)$/ argv.each_with_index do |arg, i| if arg =~ is_option k,v = arg.scan(is_option)[0][0], true elsif arg =~ is_param k,v = arg.scan(is_param)[0] else @argv.push arg end if k and v k = k.strip.to_sym k = aliases[k] if aliases[k] params[k][:value] = v end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
args_parser-0.2.0 | lib/args_parser/styles/equal.rb |