Fix: error out on leftover arguments
authorJulien Desfossez <jdesfossez@efficios.com>
Wed, 21 Feb 2018 21:57:36 +0000 (16:57 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 26 Feb 2018 22:48:05 +0000 (17:48 -0500)
commit68c7f6e55254fd6e54d7bb4a6c1316bb77843a6e
tree2b8417a9dc774cc43df866a4e3d19226fdab03fa
parentbc6bc7c52eff6431a517ba0f25f50061074949fb
Fix: error out on leftover arguments

All the commands currently ignore leftover arguments, this can lead to
wrong usage of the commands and waste of time debugging. For example,
this command enables the vpid context on all channels instead of only on
the "mychan" channel:
$ lttng add-context -u mychan -t vpid

The correct usage is:
$ lttng add-context -u -c mychan -t vpid

We now output an error on leftover arguments:
$ lttng add-context -u mychan -t vpid
Error: Unknown argument: mychan
Error: Command error

Some commands accept one leftover argument (create, start, stop,
destroy), so we check if there are other leftovers:
$ lttng create mysess allo
Error: Unknown argument: allo
Error: Command error

Only the snapshot command is not handled since it has a second level of
command and does not consume the popt arguments.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
13 files changed:
src/bin/lttng/commands/add_context.c
src/bin/lttng/commands/create.c
src/bin/lttng/commands/destroy.c
src/bin/lttng/commands/disable_channels.c
src/bin/lttng/commands/disable_events.c
src/bin/lttng/commands/enable_channels.c
src/bin/lttng/commands/enable_events.c
src/bin/lttng/commands/list.c
src/bin/lttng/commands/load.c
src/bin/lttng/commands/save.c
src/bin/lttng/commands/start.c
src/bin/lttng/commands/stop.c
src/bin/lttng/commands/view.c
This page took 0.026673 seconds and 4 git commands to generate.