cli: use argpar for top-level args
This patch replaces the hand-made parsing of the top-level arguments
with something based on the internal argpar library.
No functional changes expected from the point of view of the user.
One internal difference is that previously, the argc/argv passed to
sub-commands included an argv[0] that was ignored by popt. In the
subsequent patches, we replace popt with argpar, and argpar doesn't want
an argv[0] containing the name of the program. So instead of passing an
unnecessary argv[0], I have made it such that the argc/argv the
top-level passes to subcommands only represent the actual arguments. So
for example, with:
babeltrace2 convert -c src.ctf.fs
the bt_config_convert_from_args function used to receive this as argv:
["convert", "-c", "src.ctf.fs"]
With
babeltrace2 --debug -c src.ctf.fs
it used to receive
["--debug", "-c", "src.ctf.fs"]
With this patch, it will only receive `["-c", "src.ctf.fs"]`. So
functions bt_config_*_from_args are updated to cope with this
change. In particular, I passed the POPT_CONTEXT_KEEP_FIRST flag to
poptGetContext. But in practice, they will all disappear anyway, in
favor of argpar.
Change-Id: I9f1210f1c338c7eb39e228e20218c83e46961ee4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1789
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.02405 seconds and 5 git commands to generate.