Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possible values to help output for MapFlag #25

Open
snapbug opened this issue Jul 14, 2017 · 0 comments
Open

Add possible values to help output for MapFlag #25

snapbug opened this issue Jul 14, 2017 · 0 comments

Comments

@snapbug
Copy link

snapbug commented Jul 14, 2017

For MapFlag is it possible to get the list of possible values added to the help output? For example:

enum class Example {
  X,
  Y,
  Z
};
std::unordered_map<std::string, Example> exampleMapValues{
  {'thexoption', Example::X},
  {'theyoption', Example::Y},
  {'thezoption', Example::Z}
};
args::MapFlag<std::string, Example> exampleFlag(
  arguments, "mv", "A description", { 'm', "mapvalue" }, exampleMapValues);

Currently results in help output (for that option) of:

      -m[mv], --mapvalue=[mv]           A description

If the possible values could be automatically added to the help output, something along the lines of:

      -m[mv], --mapvalue=[mv]           A description
                                        One of: thexoption, theyoption, thezoption

Would save a lot of effort on behalf of users, and possible mistakes in forgetting to add/remove values. The information is already there as well, encoded in the unordered_map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant