option parser: decrease distance between arg and explanation

P

Patrick Gundlach

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
 
J

Jan Svitok

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) ;-)
 

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

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top