argagg
argagg copied to clipboard
Get rid of definition names, key by the option itself
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.