Opened 13 years ago
Last modified 13 years ago
#3732 new Feature Requests
Detect platform to choose delimiter to use for reading options from command line
Reported by: | anonymous | Owned by: | Vladimir Prus |
---|---|---|---|
Milestone: | Component: | program_options | |
Version: | Boost 1.41.0 | Severity: | Cosmetic |
Keywords: | Cc: | s.ochsenknecht@… |
Description
POSIX systems usually use - or -- as a "delimiter" when reading options from command lines. For e.g. the 'ls' program on a linux system:
ls --help .... -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. --author with -l, print the author of each file -b, --escape print octal escapes for nongraphic characters --block-size=SIZE use SIZE-byte blocks --help print this ....
Windows usually uses the / character instead, for e.g. for dir: dir /?: Typically, the '/' is the delimiter.
... /B Uses bare format (no heading information or summary). ...
It would be useful to have the library recognize the platform on which it is begin compiled (or even better, the platform being targeted) and use the default for that platform for reading options from the command line.
Change History (4)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Cc: | added |
---|
comment:3 by , 13 years ago
can the user actually change this default library-wide ? without changing the library source code of course.
comment:4 by , 13 years ago
It is an optional parameter of e.g. parse_command_line(): http://www.boost.org/doc/libs/1_41_0/doc/html/boost/program_options/parse_command_line.html
If you pass a user defined styl;e, then this is used instead of default_style (which is actually unix_style).
Hi,
I'm not so much familiar with other style than Linux/POSIX.
In program_options/parsers.hpp is a style enum defined, the default is set to unix_style which is:
How would it look like for Windows (ar long options allowed for windows....)? What other style's do we have (MacOS, ...) ?
Thanks, Sascha