From: Bil Kleb Date: 2007-09-07T00:30:05+09:00 Subject: minimalistic command line option parsing via -s Hi, I know, I'm slow, but I finally figured out the minimalistic command line options parsing that zenspider et al use in utilities like flog and sow (the gem skeleton generator that comes with Hoe). Consider, for example, #!/usr/bin/env ruby -s $r ||= false if defined? $h then puts "usage: #{File.basename $0}" puts " -h this usage message" puts " -r recursive" end puts "Recursive option: #$r" The secret sauce is the '-s' option passed to the interpreter, which according to the PickAxe indicates, "Any command-line switches found after the program filename, but before any filename arguments or before a --, are removed from ARGV and set to a global variable named for the switch." Later, -- Bil Kleb http://nasarb.rubyforge.org