Skip to content

Add possible values to help output for MapFlag #25

Description

@snapbug

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions