Fix: cli: don't log error when using help command with a plugin name
When using the help command with a plugin name, it works, but Babeltrace
logs an error:
09-26 16:37:03.782 10054 10054 E CLI/CFG-CLI-ARGS plugin_comp_cls_names@babeltrace2-cfg-cli-args.c:189 Missing component class type (`source`, `filter`, or `sink`).
This is problematic, because this is a valid use of the command.
Logging an error is unnecessarily alarming.
The current code takes the argument (in our case, a plugin name such as
"ctf") and passes it through plugin_comp_cls_names. The function can't
parse the string as a component class name, so logs the error mentioned
above. The caller, bt_config_help_from_args, sees that the function has
failed, so falls back to assuming the string is a plugin name, which
then works correctly.
To avoid this, the sophisticated solution I chose was to look for an
unescaped dot in the argument. If there's one, we treat it as a
component class name, if there isn't, we treat is as a plugin name.
Change-Id: I76b791e5d44436fdc5b10a3c10e3579a0783b04d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2101
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.02632 seconds and 4 git commands to generate.