cli: sync argpar - adjust to iterator API
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 21 May 2021 03:12:58 +0000 (23:12 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 27 Aug 2021 01:26:11 +0000 (21:26 -0400)
commita93e984c07724c096b4a0af678703d796e26bf0c
tree9402ef301c3fcd7919f10d760fe26b6147f2d4c7
parent0022a87819b0908869f99e08925d2d71c150b285
cli: sync argpar - adjust to iterator API

Sync with commit 1c88181255c1 ("argpar/argpar.h: update API
documentation").

The main change in this version is the API that changed from
parse-all-at-once (the `argpar_parse` function) to something based on an
iterator, where we need to call `argpar_iter_next` to obtain the next
item.

Update the top-level option parsing.  As before, we stop as soon as we
encounter an unknown option or a non-option argument.

Update all commands to use the new `parse_next_item` function, which
factors out a bit of otherwise repetitive code.

Another change in this argpar version is that argpar does not provide a
format error string anymore.  It provides an `argpar_error` object
contaning all the raw information needed to create such string.  The
new `format_arg_error` function formats the errors using the exact same
syntax as argpar did, such that no changes in the tests are necessary.

Change-Id: Ied9080953a0bb1b81f9880263a3f9dd1724eba07
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/5928
Tested-by: jenkins <jenkins@lttng.org>
src/argpar/argpar.c
src/argpar/argpar.h
src/cli/babeltrace2-cfg-cli-args.c
This page took 0.024576 seconds and 4 git commands to generate.