option parser: decrease distance between arg and explanation

Discussion in 'Ruby' started by Patrick Gundlach, Jan 23, 2007.

  1. Hi all,

    I use option parser and I would like to decrease a distance in the
    output. Example:

    #!/usr/bin/env ruby

    require "optparse"

    a=ARGV.options { |opts|
    opts.on("-a","--all","do everything")
    opts.on("-h","--help") do
    puts opts
    exit 0
    end
    opts.parse!
    }

    result:

    Usage: optparsetest [options]
    -a, --all do everything
    -h, --help


    I'd like to decrease the distance between "--all" and "do everything,
    such as

    Usage: optparsetest [options]
    -a, --all do everything
    -h, --help

    Anybody know how to achieve this?

    Thanks,

    Patrick

    --
    Posted via http://www.ruby-forum.com/.
     
    Patrick Gundlach, Jan 23, 2007
    #1
    1. Advertising

  2. Patrick Gundlach

    Jan Svitok Guest

    On 1/23/07, Patrick Gundlach <> wrote:
    > Hi all,
    >
    > I use option parser and I would like to decrease a distance in the
    > output. Example:
    >
    > #!/usr/bin/env ruby
    >
    > require "optparse"
    >
    > a=ARGV.options { |opts|

    + opts.summary_width = 10
    > opts.on("-a","--all","do everything")
    > opts.on("-h","--help") do
    > puts opts
    > exit 0
    > end
    > opts.parse!
    > }
    >
    > result:
    >
    > Usage: optparsetest [options]
    > -a, --all do everything
    > -h, --help
    >
    >
    > I'd like to decrease the distance between "--all" and "do everything,


    use OptionParser#summary_width

    http://ruby-doc.org/core/classes/OptionParser.html, or RTFineS (they
    are pretty readable) ;-)
     
    Jan Svitok, Jan 23, 2007
    #2
    1. Advertising

  3. Patrick Gundlach, Jan 23, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. fitwell
    Replies:
    7
    Views:
    749
    Sid Ismail
    Nov 19, 2003
  2. Replies:
    3
    Views:
    2,160
  3. n00m
    Replies:
    5
    Views:
    396
  4. Replies:
    7
    Views:
    179
  5. Replies:
    21
    Views:
    310
    Barry Schwarz
    Mar 5, 2014
Loading...

Share This Page