require "optiflag"Here is the official documentation with an example.
require "log"
module Options extend OptiFlagSet
optional_switch_flag "debug"
optional_flag "date"
usage_flag "help"
and_process!
end
if Options.flags.debug?
Log.on
Log.log "debug mode on"
end
if Options.flags.date != nil
puts "-date #{Options.flags.date}"
end
Sunday, November 15, 2009
Ruby Command Line Parsing
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment