[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Is there any Ruby parser for command inline parameters (ARGV[])?

Iñaki Baz Castillo

4/5/2008 3:02:00 PM

Hi, I usually do Ruby scripts for some tasks and many of them allow inline=
=20
parameters, for example:

./script1.rb -n -vv -o file.out filein

Is there any Ruby library/gem to parse inline parameters easily? this is,=20
parsing ARGV Array.

Thanks.

=2D-=20
I=C3=B1aki Baz Castillo

3 Answers

Stefano Crocco

4/5/2008 3:06:00 PM

0

On Saturday 05 April 2008, I=C3=B1aki Baz Castillo wrote:
> Hi, I usually do Ruby scripts for some tasks and many of them allow inline
> parameters, for example:
>
> ./script1.rb -n -vv -o file.out filein
>
> Is there any Ruby library/gem to parse inline parameters easily? this is,
> parsing ARGV Array.
>
> Thanks.

There's OptionParser which is included in ruby standard library. Use ri=20
OptionParser to learn more about it (you need to require 'optparse' before =
you=20
can use it)

Stefano


Nikita Petrov

4/5/2008 3:54:00 PM

0

On 5 =D0=B0=D0=BF=D1=80, 19:01, I=C3=B1aki Baz Castillo <i...@aliax.net> wro=
te:
> Hi, I usually do Ruby scripts for some tasks and many of them allow inline=

> parameters, for example:
>
> ./script1.rb -n -vv -o file.out filein
>
> Is there any Ruby library/gem to parse inline parameters easily? this is,
> parsing ARGV Array.
>
> Thanks.
>
> --
> I=C3=B1aki Baz Castillo

You can also try "getoptlog" library.

Iñaki Baz Castillo

4/5/2008 3:58:00 PM

0

El S=C3=A1bado, 5 de Abril de 2008, Stefano Crocco escribi=C3=B3:
> On Saturday 05 April 2008, I=C3=B1aki Baz Castillo wrote:
> > Hi, I usually do Ruby scripts for some tasks and many of them allow
> > inline parameters, for example:
> >
> > ./script1.rb -n -vv -o file.out filein
> >
> > Is there any Ruby library/gem to parse inline parameters easily? this i=
s,
> > parsing ARGV Array.
> >
> > Thanks.
>
> There's OptionParser which is included in ruby standard library. Use ri
> OptionParser to learn more about it (you need to require 'optparse' before
> you can use it)

Thanks a lot, I'll try it.


=2D-=20
I=C3=B1aki Baz Castillo