[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Question about main

Jesús Gabriel y Galán

10/3/2007 2:55:00 PM

Hi,

I'm trying to use main for the following case:

program.rb -d 120 -z 7 /folder1 /folder2 /folder3 ...

I'm using Ara's main gem. I know you can specify arity for a parameter
but I don't know if it's possible to capture all arguments:

require 'main'

main {
option("zip", "z") {
argument :required
description "Zip files older than the specified number of days"
cast :int
}
option("delete", "d") {
argument :required
defaults 7
description "Delete files older than the specified number of days.
If --zip option is specified, only delete the files that are in
between both dates"
cast :int
}
argument("folders") {
required
argument :required
arity 3 # but would like to capture all of them if there's more
}

def run
p params[:folders].values #I would like this to be all params
end
}

Is there a way?

Jesus.