boostorg / boostorg/program_options
Supplying a list of possible values instead of a default value to an option?
- Dominant language
- C++
- Stars
- 136
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Description
Is there a way to specify a restricted list of values a command line option can take? I was thinking of something like this:
```
#include
namespace po = boost::program_options;
po::options_description description("General options");
description.add_options()
("key", po::value()->possible_values("a", "b", "c"), "description of key");
```
Running `executable --key d` in the command line would throw an error but `executable --key a` would not. I know there is the option of manually processing the argument supplied to the key later on, but I was wondering if the functionality of identifying unambiguous abbreviations could be utilised.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.