opts.on(‘-p’, ‘–assets_path’, ‘assets_path’) { |v|
sync_simulator.rb --app angry --assets_path /Users/paul/worms
I am hoping to get
key is ios_version
value is 7.0
key is assets_path
value is /Home/paul/worms
key is app_name
value is angry
You need to indicate to OptParser that you expect an argument, otherwise
it returns true to say “I saw that option on the command line”. This can
be done by adding a token to the long flag (for more detail see
options.each_pair do |key, value|
puts “key is #{key}”
puts “value is #{value}”
end
END
ratdog:tmp mike$ ./try.rb --app angry --assets_path /Users/paul/worms
–ios_version 7.0
key is app_name
value is angry
key is assets_path
value is /Users/paul/worms
key is ios_version
value is 7.0