Sharg 1.1.2-rc.1
The argument parser for bio-c++ tools.
|
Option struct that is passed to the sharg::parser::add_option()
function.
More...
#include <sharg/config.hpp>
Public Attributes | |
char | short_id {'\0'} |
The short identifier for the option (e.g. 'a', making the option callable via -a ). | |
std::string | long_id {} |
The long identifier for the option (e.g. "age", making the option callable via --age ). | |
std::string | description {} |
The description to be shown on any (exported) help page. | |
std::string | default_message {} |
The default message to be shown on any (exported) help page. | |
bool | advanced {false} |
Whether the option should only be displayed on the advanced help page. | |
bool | hidden {false} |
Whether the option should be hidden. | |
bool | required {false} |
Whether the option is required. | |
validator_t | validator {} |
A sharg::validator that verifies the value after parsing (callable). | |
Option struct that is passed to the sharg::parser::add_option()
function.
The following table gives an overview about which parameters are valid for which type of option added to the parser. Please see the individual entities for detailed documentation.
✓
- Parameter can be set for this type of option(✓)
- Parameter can be set but is not indented for this type of optionX
- Setting this parameter for this type of option raises a sharg::design_errorParameter | option ( -a/--all ) | flag (-f ) | positional_option (foo ) |
---|---|---|---|
sharg::config::short_id | ✓ | ✓ | X |
sharg::config::long_id | ✓ | ✓ | X |
sharg::config::description | ✓ | ✓ | ✓ |
sharg::config::default_message | ✓ | X | X |
sharg::config::advanced | ✓ | ✓ | X |
sharg::config::hidden | ✓ | ✓ | X |
sharg::config::required | ✓ | ✓ | (✓) |
sharg::config::validator | ✓ | (✓) | ✓ |
bool sharg::config< validator_t >::advanced {false} |
Whether the option should only be displayed on the advanced help page.
This is only relevant for the help page printed on the command line. If set to true, the option will only be displayed when the user requests the advanced help via ./executable --advanced-help
or ./executable -hh
.
This can help to not overwhelm the user with parameters but still provide an extensive interface of your application.
When information are exported with --export-help
, advanced options are always shown.
std::string sharg::config< validator_t >::default_message {} |
The default message to be shown on any (exported) help page.
"Default: " will be prepended. "." will be appended.
‘parser.add_option(j, sharg::config{.short_id = 'j’. default_message = "Same as -i"})` will result in the help page looking like this:
std::string sharg::config< validator_t >::description {} |
The description to be shown on any (exported) help page.
bool sharg::config< validator_t >::hidden {false} |
Whether the option should be hidden.
If set to true, the option will not be displayed on any help page; Neither when calling ./executable --help
, nor when exported with --export-help
.
std::string sharg::config< validator_t >::long_id {} |
The long identifier for the option (e.g. "age", making the option callable via --age
).
bool sharg::config< validator_t >::required {false} |
Whether the option is required.
If set to true and the user does not provide the respective option on the command line, the argument_parser will automatically detect this and throw a sharg::invalid_argument exception.
char sharg::config< validator_t >::short_id {'\0'} |
The short identifier for the option (e.g. 'a', making the option callable via -a
).
validator_t sharg::config< validator_t >::validator {} |
A sharg::validator that verifies the value after parsing (callable).