Lyra
Lyra copied to clipboard
Multiple commands declared at the same level are parsed and executed in sequence
When one defines multiple commands at the same level
cli.add_argument(
lyra::command("foo", [&](lyra::group const& g) { fmt::println("running foo"); })
);
cli.add_argument(
lyra::command("bar", [&](lyra::group const& g) { fmt::println("running bar"); })
);
Then the following invocation exec foo bar
prints
running foo
running bar
I think the expectation here is that only one command is recognized and the other rejected as a syntax error.
Note that this differs from nesting commands like this
cli.add_argument(
lyra::command("foo", [&](lyra::group const& g) { fmt::println("running foo"); })
.add_argument(
lyra::command("bar", [&](lyra::group const& g) { fmt::println("running bar"); })
)
);
Which when invoked with exec foo bar
prints
running bar
running foo
And works as expected.