commander-rb / commander

The complete solution for Ruby command-line executables
MIT License
821 stars 74 forks source link

Multiline option descriptions #18

Closed badeball closed 8 years ago

badeball commented 8 years ago

9ea5c0f added indentation of program and command descriptions. However, I've found myself also sometimes wanting multiline option descriptions, like the -u option from git-commit have (shown below). This patch adds identing of option descriptions.

       -u[<mode>], --untracked-files[=<mode>]
           Show untracked files.

           The mode parameter is optional (defaults to all), and is used to specify the handling of untracked files; when -u is not used, the default is normal, i.e. show untracked files and directories.

           The possible options are:

           ·   no - Show no untracked files

           ·   normal - Shows untracked files and directories

           ·   all - Also shows individual files in untracked directories.

               The default can be changed using the status.showUntrackedFiles configuration variable documented in git-config(1).
ggilder commented 8 years ago

Thanks! And sorry for the delay looking at this one!

ggilder commented 8 years ago

This has been released in 4.3.6: https://rubygems.org/gems/commander/versions/4.3.6

Thanks again!

badeball commented 8 years ago

@ggilder, it may seem that we were both a bit quick with this one. If one omits the description for an option, an error is raised.

lib/commander/help_formatters.rb:46:in `indent': undefined method `gsub' for nil:NilClass (NoMethodError)
ggilder commented 8 years ago

Good catch! I've just pushed 4.3.7 with a fix for that.