cli: handle leftovers in the same loop as components
[this patch is better viewed with `git show -w`]
Handle leftovers (put them in the leftovers array) at the same time as
we process --component options and things that apply to components
(--params and --log-level). When we handle a leftover, assign the
current_item_type variable, to override the previous current item.
This change makes it so that we prevent processing --params or
--log-level after a leftover. Previously, this command line:
babeltrace2 -c src.bon.jour some-leftover --params=a=2
Would apply the `a=2` param to the `src.bon.jour` instance, since it was
the last component declared. This is confusing, however, because of the
some-leftover leftover in between.
With this patch, the `some-leftover` leftover becomes the "currently"
processed item when we reach it. And since it's not possible (for the
moment) to apply --params or --log-level to a leftover, the command line
shown above now result in the error:
No current component of which to set parameters:
a=2
I improved test_convert_args to be able to check the error message of a
bt2 run we expect to fail. This lets us avoid cases where babeltrace
fails for an unexpected reason, but the test still passes.
Change-Id: I0e065c1cd5f32f59292c9a40c6a8077a52d35237
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1806
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
This page took 0.026221 seconds and 4 git commands to generate.