Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > option parser: decrease distance between arg and explanation

Reply
Thread Tools

option parser: decrease distance between arg and explanation

 
 
Patrick Gundlach
Guest
Posts: n/a
 
      01-23-2007
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/.

 
Reply With Quote
 
 
 
 
Jan Svitok
Guest
Posts: n/a
 
      01-23-2007
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)

 
Reply With Quote
 
 
 
 
Patrick Gundlach
Guest
Posts: n/a
 
      01-23-2007
Hello Jan,

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


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

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pass a multiline arg to exec('some.exe arg')? n00m Python 5 05-05-2008 02:58 PM
Distance between 2points (squareroot and power of help needed) gbvk@hotmail.co.uk C++ 5 03-13-2008 12:14 AM
Trouble with setTimeout(arg, arg) nat.hourt@gmail.com Javascript 7 11-12-2005 05:13 PM
Setting the distance between numbers and text in an ordered list. richard_quick_uk@hotmail.com HTML 3 07-30-2005 02:53 AM
How do I decrease spacing in between elements (there are no <br> codes to delete)? fitwell HTML 7 11-19-2003 08:25 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57