cli: use argpar for parsing help command's arguments
authorSimon Marchi <simon.marchi@efficios.com>
Sat, 27 Jul 2019 03:37:22 +0000 (23:37 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 2 Aug 2019 15:46:54 +0000 (11:46 -0400)
commit13ae36e10129c4d2dfb2da6b08faf5dd9065f4c3
tree769efac3630f91632ce66bdf9dbcec00ca35a84c
parentca60bbc338aa007b446caf11d0abecb7bb7d2bcb
cli: use argpar for parsing help command's arguments

All straightforward, except that there is a functional change as part
of this patch.  It was possible to pass multiple leftovers, and only the
first one was considered.

    babeltrace2 help ctf tintin

did the same as

    babeltrace2 help ctf

It now prints a beautiful error:

./src/cli/babeltrace2 help ctf tintin

    ERROR:    [Babeltrace CLI] (/home/smarchi/src/babeltrace/src/cli/babeltrace2.c:2564)
      Command-line error: retcode=1
    CAUSED BY [Babeltrace CLI] (/home/smarchi/src/babeltrace/src/cli/babeltrace2-cfg-cli-args.c:1461)
      Extraneous command-line argument specified to `help` command: `tintin`.

Change-Id: I2c8f8610004d60a0844d18c9d622037cc7c1c04c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1792
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/cli/babeltrace2-cfg-cli-args.c
This page took 0.024599 seconds and 4 git commands to generate.