Question about main

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs