Closed OliverSchmitz closed 2 years ago
The reason for this is that the way you specified the arguments:
cli.add_argument(lyra::opt(opA, "ON|OFF")["--optionA"]
| lyra::arg(argsA, "args"));
cli.add_argument(lyra::opt(opB, "ON|OFF")["--optionB"]
| lyra::arg(argsB, "args"));
Is equivalent to:
cli.add_argument(lyra::opt(opA, "ON|OFF")["--optionA"]);
cli.add_argument(lyra::arg(argsA, "args"));
cli.add_argument(lyra::opt(opB, "ON|OFF")["--optionB"]);
cli.add_argument(lyra::arg(argsB, "args"));
I think what you want is to use a group
for each option+args. Something like this:
cli.add_argument(lyra::group().sequential()
| lyra::opt(opA, "ON|OFF")["--optionA"]
| lyra::arg(argsA, "args"));
cli.add_argument(lyra::group().sequential()
| lyra::opt(opB, "ON|OFF")["--optionB"]
| lyra::arg(argsB, "args"));
Hello, after first successful experiments with Lyra I'm now stuck with something. I try to apply multiple arguments to several options, like this:
when executing with
./testargs --optionA=ON a1 a2 a3 --optionB=ON b1 b2
I'd expect to get a1, a2, a3 in argsA and b1,b2 in argsB. However, all end up in argsA, and --optionB seems not to be recognised. The usage info from the help looks ok imo. The output for info:Am I doing something entirely wrong, or is there another way to obtain the arguments per option? Thanks in advance!