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

Get rid of definition names, key by the option itself #14

Open
vietjtnguyen opened this issue Oct 27, 2017 · 0 comments
Open

Get rid of definition names, key by the option itself #14

vietjtnguyen opened this issue Oct 27, 2017 · 0 comments

Comments

@vietjtnguyen
Copy link
Owner

I realized that the definition name isn't really needed. I used it because I wanted a name to key on so that you can reference the option's parse results using that name, but why not just reference the option by any one of the options' flags? So instead of

//...
  parser argparser {{
//...
      {
        "sep", {"-s", "--sep"},
        "separator (default ',')", 1},
//...
    }};
//...
  auto sep = args["sep"].as<string>(",");
//...

you can just do

//...
  parser argparser {{
//...
      {
        {"-s", "--sep"},
        "separator (default ',')", 1},
//...
    }};
//...
  auto sep = args["--sep"].as<string>(",");
  // or alternatively...
  //auto sep = args["-s"].as<string>(",");
//...

The option name isn't really used for anything else.

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