
Hi! I cannot find in docs how to create named vales for producing output like shown in this example from docs: $bin/gcc/debug/multiple_sources --help Allows options: Generic options: -v [ --version ] : print version string --help : produce help message Configuration: --optimization n : optimization level -I [ --include-path ] path : include path The "--include-path" option shown above has "path" parameter, what I have is "arg".

Also I don't understand how to restrict hidden values. For example I want command "myutil --help restrict this" to throw exeption but it doesn't do it now. The code I have: po :: options_description optionsDescription ("Allowed options"); optionsDescription.add_options () ("help,h", "produce help message.") ("something-else", po :: value <std :: string> (), "something else."); po :: variables_map options; try { po :: store (po :: parse_command_line (argc, argv, optionsDescription), options); } catch (po :: unknown_option x) { std :: cout << x.what () << std :: endl; return return_user_fault; } po :: notify (options); if (options.count ("help")) { std :: cout << optionsDescription << std :: endl; return ioc_util_return_success; }

Hi! I have already asked this question about a month ago. But it wasn't answered and I suppose to repeat. I cannot find in docs how to create named vales for producing output like shown in this example from docs: $bin/gcc/debug/multiple_sources --help Allows options: Generic options: -v [ --version ] : print version string --help : produce help message Configuration: --optimization n : optimization level -I [ --include-path ] path : include path The "--include-path" option shown above has "path" parameter, what I have is "arg". Also I don't understand how to restrict hidden values. For example I want command "myutil --help restrict this" to throw an exception because of "restrict" and "this" but it doesn't do it. Regards. Igor.

Igor Mikushkin wrote:
Hi!
I have already asked this question about a month ago. But it wasn't answered and I suppose to repeat.
I cannot find in docs how to create named vales for producing output like shown in this example from docs:
$bin/gcc/debug/multiple_sources --help Allows options:
Generic options: -v [ --version ] : print version string --help : produce help message
Configuration: --optimization n : optimization level -I [ --include-path ] path : include path
The "--include-path" option shown above has "path" parameter, what I have is "arg".
The docs example appears to be stale -- the code always produces 'args'. I think it's OK, because it relieves you from the need to think out witty names for parameters. Above, the word 'path' occurs three times on a line, and probably does not add much value.
Also I don't understand how to restrict hidden values.
For example I want command "myutil --help restrict this" to throw an exception because of "restrict" and "this" but it doesn't do it.
Why? 'restrict' appears to the value of the option --help, and this is an argument. What's wrong? - Volodya

2008/2/19, Vladimir Prus
Igor Mikushkin wrote:
Hi!
I have already asked this question about a month ago. But it wasn't answered and I suppose to repeat.
I cannot find in docs how to create named vales for producing output like shown in this example from docs:
$bin/gcc/debug/multiple_sources --help Allows options:
Generic options: -v [ --version ] : print version string --help : produce help message
Configuration: --optimization n : optimization level -I [ --include-path ] path : include path
The "--include-path" option shown above has "path" parameter, what I have is "arg".
The docs example appears to be stale -- the code always produces 'args'. I think it's OK, because it relieves you from the need to think out witty names for parameters. Above, the word 'path' occurs three times on a line, and probably does not add much value.
OK. Although I think that the ability to override this standard manner can't be redundant.
Also I don't understand how to restrict hidden values.
For example I want command "myutil --help restrict this" to throw an exception because of "restrict" and "this" but it doesn't do it.
Why? 'restrict' appears to the value of the option --help, and this is an argument. What's wrong?
"--help" option doesn't has any arguments in my tool. Of course program_options processes all the arguments right and my tool works fine. But it just ignores separate words in the command line that does not started with "-" or "--". My tool does not have any commands or parameters like input files, etc. I ask if I can restrict commands like "myutil 1 2 3 4 5 the rabbit went out" Igor

Igor Mikushkin wrote:
2008/2/19, Vladimir Prus
: Igor Mikushkin wrote:
Hi!
I have already asked this question about a month ago. But it wasn't answered and I suppose to repeat.
I cannot find in docs how to create named vales for producing output like shown in this example from docs:
$bin/gcc/debug/multiple_sources --help Allows options:
Generic options: -v [ --version ] : print version string --help : produce help message
Configuration: --optimization n : optimization level -I [ --include-path ] path : include path
The "--include-path" option shown above has "path" parameter, what I have is "arg".
The docs example appears to be stale -- the code always produces 'args'. I think it's OK, because it relieves you from the need to think out witty names for parameters. Above, the word 'path' occurs three times on a line, and probably does not add much value.
OK. Although I think that the ability to override this standard manner can't be redundant.
Also I don't understand how to restrict hidden values.
For example I want command "myutil --help restrict this" to throw an exception because of "restrict" and "this" but it doesn't do it.
Why? 'restrict' appears to the value of the option --help, and this is an argument. What's wrong?
"--help" option doesn't has any arguments in my tool. Of course program_options processes all the arguments right and my tool works fine. But it just ignores separate words in the command line that does not started with "-" or "--". My tool does not have any commands or parameters like input files, etc. I ask if I can restrict commands like "myutil 1 2 3 4 5 the rabbit went out"
No. Anything that is not an option is assumed to be a parameter. - Volodya

2008/2/19, Vladimir Prus
: Igor Mikushkin wrote:
For example I want command "myutil --help restrict this" to throw an exception because of "restrict" and "this" but it doesn't do it.
Why? 'restrict' appears to the value of the option --help, and this is an argument. What's wrong?
"--help" option doesn't has any arguments in my tool. Of course program_options processes all the arguments right and my tool works fine. But it just ignores separate words in the command line that does not started with "-" or "--". My tool does not have any commands or parameters like input files, etc. I ask if I can restrict commands like "myutil 1 2 3 4 5 the rabbit went out"
No. Anything that is not an option is assumed to be a parameter.
OK. Thanks for the answer. Igor
participants (2)
-
Igor Mikushkin
-
Vladimir Prus