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:40 +0000 (10:09 -0500)
commit266d3dd051c2c5e2a23009afbdc88b72c0fded5b
tree5a498fe3844d665543f9a2f4ac83568aedffba03
parent40096142f5428ba357fc69e6a9a1330c72ac7e5e
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.026806 seconds and 4 git commands to generate.