# Option parser: decrease distance between arg and explanation

**URL:** <https://www.ruby-forum.com/t/option-parser-decrease-distance-between-arg-and-explanation/83054>\
**Category:** Ruby\
**Created:** [January 23, 2007, 10:49am UTC](https://www.ruby-forum.com/t/option-parser-decrease-distance-between-arg-and-explanation/83054 "2007-01-23T10:49:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgundlach](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pgundlach](https://www.ruby-forum.com/u/pgundlach)\
**Post date:** [January 23, 2007, 10:49am UTC](https://www.ruby-forum.com/t/option-parser-decrease-distance-between-arg-and-explanation/83054/1 "2007-01-23T10:49:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pgundlach](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pgundlach](https://www.ruby-forum.com/u/pgundlach)\
**Post date:** [January 23, 2007, 3:55pm UTC](https://www.ruby-forum.com/t/option-parser-decrease-distance-between-arg-and-explanation/83054/2 "2007-01-23T15:55:41Z")

</div>

On 1/23/07, Patrick G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](http://ruby-doc.org/core/classes/OptionParser.html), or RTFineS (they  
are pretty readable) 😉

---

<div class="post-metadata">

**Author:** ![pgundlach](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pgundlach](https://www.ruby-forum.com/u/pgundlach)\
**Post date:** [January 23, 2007, 4:06pm UTC](https://www.ruby-forum.com/t/option-parser-decrease-distance-between-arg-and-explanation/83054/3 "2007-01-23T16:06:14Z")

</div>

Hello Jan,

> use OptionParser#summary\_width
> 
> [http://ruby-doc.org/core/classes/OptionParser.html](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
