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>
Tue, 27 Feb 2018 15:09:15 +0000 (10:09 -0500)
commita798f0b9e90ece41ef78d89f707264561cf2c79e
tree101390a6c200b7e3fa9e985feb6b53a67586cd96
parentb28f7baa20013dcc2098ab072f72623360f8d6f9
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.026891 seconds and 4 git commands to generate.