Issue with 'OptionsParser' and my brain

A

Aldric Giacomoni

So, I followed the tutorial and got this far..
http://rubyforge.org/docman/view.php/632/233/posted-docs.index.html

Now, I can't figure out how I get these options out of this class and
into my code! A little help is appreciated, please :)

class Options < CommandLine::Application
def initialize
synopsis "[-aX] etc etc"
short_description "a 1"
long_description "This program is intended to be run from the Fusion
server. It will"
options :help
option :names => ["-a", "--LogAge"], :eek:pt_found => get_args,
:eek:pt_description => "How many months to keep unzipped.",
:arg_description => "integer"
option :names => ["-t", "--to"], :eek:pt_found => get_args,
:eek:pt_description => "The recipient of the error logs",
:arg_description => "email address"
option :names => ["-f", "--from"], :eek:pt_found => get_args,
:eek:pt_description => "The sender of the error logs",
:arg_description => "email address"
end
def main
puts "args: #{args}"
puts "-a #{opt["-a"]}"
puts "-t #{opt["-t"]}"
puts "-f #{opt["-f"]}"
end
end

--Aldric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top