I'm trying to figure out how to define subparameters for one of my parameters. This is what I have that is NOT working:
require 'optparse'
options = {}
OptionParser.new do |parser|
parser.on("-r", "--require LIBRARY", "Require the LIBRARY before executing your script") do |lib|
parser.make_switch(["-p"], '--pop THING') do |o|
puts "You required #{o}!"
end
end
parser.on("-f", '--file FILE', 'File to be processed') do |file|
puts "This is the file: #{file}"
end
end.parse!
I'd like to do:
ruby myapp -r Library -p thing #<--required params
or
ruby myapp -f