Closed apavlenko closed 6 years ago
You can always handle it in your code
int logLvl = 0; // Off by default
if(args["log"]) {
logLvl = 3; // Enable default level
if(args["log"].as<std::string>()=="errors-only") logLvl = 1; // Use custom
}
Yea, my concern with having that style of optional argument is that it actually introduces a third state to the flag. Also, it messes with the current greedy argument behavior. For example, foo --log --verbose
would make --verbose
an argument to --log
.
Currently a flag has two states:
I feel like if there's some default behavior you want with a flag specified with no argument it can be captured by its own flag. Consider git log
for example, --oneline
is equivalent to --pretty=oneline
.
I'm going to close this for now though I'm open to further discussion in this issue.
Is it possible to support an optional argument for parameter? E.g. it should be possible to use both
--log
and--log=errors-only
(the 1st variant assumes some default level)