Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#4644 closed Patches (fixed)

Do not print empty long program option name

Reported by: vlad@… Owned by: Vladimir Prus
Milestone: To Be Determined Component: program_options
Version: Boost 1.44.0 Severity: Cosmetic
Keywords: Cc:

Description

This patch partially solves the problem when there is only short option name for the parameter and option_description class generates ugly help message. For example -

{{{(",w", po::value<int>(), "Perfrom write with N frames")}}}

generates this

{{{-w [ -- ] arg : Perfrom write with N frames}}}

The "[ -- ]" part is confusing. So if long option name is empty, we don't print that part.

Ideally, we should also print one dash for single character long option name if command_line_style::allow_long_disguise is specified, but I can't find a way to access those styles from option_description.

Originally, the problem found by a guy at Stack Overflow - http://stackoverflow.com/questions/3621181/short-options-only-in-boostprogram-options

Attachments (1)

options_description.cpp.diff (626 bytes ) - added by vlad@… 12 years ago.
Diff for the option_description fix

Download all attachments as: .zip

Change History (6)

by vlad@…, 12 years ago

Diff for the option_description fix

comment:1 by Vladimir Prus, 12 years ago

Resolution: fixed
Status: newclosed

(In [65645]) Fix formatting of short-only options.

Fixes #4644.

comment:2 by Vladimir Prus, 12 years ago

Thanks for the patch, I've checked it in. About style and long disguise -- I'm not sure we can do anything, because the parsing style is only know when we actually parse things.

comment:3 by anonymous, 11 years ago

The patch is not in release 1.49.0!?

comment:4 by anonymous, 10 years ago

Is there any chance that this feature request will be included into a release. I won't call this a showstopper but still would this make the library more complete from a library user point of view.

comment:5 by Vladimir Prus, 10 years ago

Ehm, that patch is in the release branch. Since 2012-04-08. So not only it's included in next release, but also in the last one.

Note: See TracTickets for help on using tickets.