Fix: cli: use correct argument index in subcommand error messages
Because command implementation are not aware that there may have been
arguments before the ones they receive, the argument number in
argument-parsing-related error messages is off:
$ ./src/cli/babeltrace2 --omit-home-plugin-path convert --foo
ERROR: [Babeltrace CLI] (/home/simark/src/babeltrace/src/cli/babeltrace2.c:2644)
Command-line error: retcode=1
CAUSED BY [Babeltrace CLI] (/home/simark/src/babeltrace/src/cli/babeltrace2-cfg-cli-args.c:1423)
While parsing `convert` command's command-line arguments: While parsing argument #1 (`--foo`): Unknown option `--foo`
The `argument #1` message referring to `--foo` is erroneous, from the
point of view of the user.
Fix that by passing down an offset to apply to argument indices when
error messages are generated.
Change-Id: Ib3254094ed5e3de858f5a69cd1dc02f840a92939
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/5929
This page took 0.024221 seconds and 4 git commands to generate.