David C. wrote in post #1023941: > I'm not sure where that syntax for OptionParser came, and Trollop is a > fine lib, but if you want to stick with just Ruby standard library > stuff: > > require 'optparse' > > options = {} > opts = OptionParser.new do |opts| > > opts.on('-s SOURCE_PATH','Source path') do |path| > options[:source_path] = path > end > opts.on('-d DEST_PATH','Destination path') do |path| > option[:dest_path] = path > end > opts.on('-v','Be verbose') do > options[:verbose] = true > end > end > opts.parse! > > puts "Source Path is: #{options[:source_path]" > puts "Dest Path is: #{options[:dest_path]" > puts "We are being verbose" if options[:verbose] > > It's a bit more code, but you also get built-in help: > > $ my_app --help > Usage: my_app [options] > > -s SOURCE_PATH Source path > -d DEST_PATH Dest path > -v Be verbose > > You can use long-form options as well (e.g. --verbose) Now that's a better example of OptionParser and that could come in handy some time. I may even switch over to it since now I want to present syntax help. The version I posted works EXACTLY as I would like, so that's good. Someone else posted a solution, and I appreciate it, but no time to look at it. To the person who explained why I need to use .send(), thanks. That's very interesting and I'll have to keep that in mind. That could come in handy some day in some situations. I know that would drive a pure OO person crazy, but I can see some uses for that. Thanks all. I think this has been completely cracked and solved. Exactly as I would like plus a clear(er) OptionParser example. Cheers! -pj (soon, hopefully to be "rj"... RubyJunkie) -- Posted via http://www.ruby-forum.com/.