You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to figure out, how to implement an option for a "verbosity" level -v. The idea is that it should be repeatable and joinable, i.e. -v should set it to 1, -vvv should set it to 3.
I have found an example for repeatable and joinable options:
auto cli = joinable(
repeatable(
option("a")([&]{++as;}) |
option("b")([&]{++bs;})
)
);
which works fine. But when I try to define my option:
auto verb = 0;
bool d = false;
auto cli = (<...>,
joinable(repeatable(option("-v").call(increment(verb)) % verb_help))
// joinable(repeatable(option("-v").call(increment(verb)) % verb_help, option("-d").set(d)))
);
the parsing fails on anything different from -v. What I found that it starts working as expected when I add "dummy" option -d to the joinable and repeatable list.
The text was updated successfully, but these errors were encountered:
I am trying to figure out, how to implement an option for a "verbosity" level
-v
. The idea is that it should be repeatable and joinable, i.e.-v
should set it to 1,-vvv
should set it to 3.I have found an example for repeatable and joinable options:
which works fine. But when I try to define my option:
the parsing fails on anything different from
-v
. What I found that it starts working as expected when I add "dummy" option-d
to the joinable and repeatable list.The text was updated successfully, but these errors were encountered: