-
Notifications
You must be signed in to change notification settings - Fork 157
Open
Description
Hi,
some time ago I stumbled upon a problem with CLI, which consisted of three or more commands. I have found a work-around and I am posting it here hoping it will help others struggling with the same.
The smallest non-working example is:
auto cli = (
command("a").set(m.a) |
command("b").set(m.b) |
(
command("c").set(m.c) & value("i", m.i)
)
);where clipp would parse a, b, but not c 123.
It turned out that I can make clipp do what I want if instead of specifying the alternative of commands with | I'd use clipp::one_of.
The example above becomes:
auto cli = one_of(
command("a").set(m.a),
command("b").set(m.b),
command("c").set(m.c) & value("i", m.i)
);The docs, unless I am missing something, specify that one_of is the same as |, yet they produce different usage lines. The first one gives
((a|b) | (c <i>))
while the second one
(a | b | (c <i>))
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels