Option parser: decrease distance between arg and explanation

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

On 1/23/07, Patrick G. [email protected] 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

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) :wink:

Hello Jan,

use OptionParser#summary_width

http://ruby-doc.org/core/classes/OptionParser.html, or RTFineS (they
are pretty readable) :wink:

thanks for the answer, it is more verbose then the file I had on my
harddisk. I’ve got it to work now.

Thanks again,

Patrick

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