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

Discussion in 'Ruby' started by Iñaki Baz Castillo, Apr 5, 2008.

  1. 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
     
    Iñaki Baz Castillo, Apr 5, 2008
    #1
    1. Advertisements

  2. 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
     
    Stefano Crocco, Apr 5, 2008
    #2
    1. Advertisements

  3. You can also try "getoptlog" library.
     
    Nikita Petrov, Apr 5, 2008
    #3
  4. El S=C3=A1bado, 5 de Abril de 2008, Stefano Crocco escribi=C3=B3:
    Thanks a lot, I'll try it.


    =2D-=20
    I=C3=B1aki Baz Castillo
     
    Iñaki Baz Castillo, Apr 5, 2008
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.