Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Issue with 'OptionsParser' and my brain
aldric[removeme]
1/28/2009 9:07:00 PM
So, I followed the tutorial and got this far..
http://rubyforge.org/docman/view.php/632/233/posted-docs....
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"], :opt_found => get_args,
:opt_description => "How many months to keep unzipped.",
:arg_description => "integer"
option :names => ["-t", "--to"], :opt_found => get_args,
:opt_description => "The recipient of the error logs",
:arg_description => "email address"
option :names => ["-f", "--from"], :opt_found => get_args,
:opt_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
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Issue with 'OptionsParser' and my brain
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password