From: Simon Marchi Date: Mon, 9 Aug 2021 14:06:32 +0000 (-0400) Subject: Fix: cli: use correct argument index in subcommand error messages X-Git-Url: https://git.efficios.com/?a=commitdiff_plain;h=a80892bab38643e037d92efae2a9d0de1e006785;hp=a80892bab38643e037d92efae2a9d0de1e006785;p=babeltrace.git 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 Reviewed-on: https://review.lttng.org/c/babeltrace/+/5929 ---