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>