From: Philippe Proulx Date: Tue, 10 May 2016 19:31:58 +0000 (-0400) Subject: lttng.c: show basic help when no arguments are provided X-Git-Tag: v2.9.0-rc1~250 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9fb6c2dbea6c22a5f047ec90575e0b8a053db393;p=lttng-tools.git lttng.c: show basic help when no arguments are provided Fixes #1011 Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c index b498539c7..02903becd 100644 --- a/src/bin/lttng/lttng.c +++ b/src/bin/lttng/lttng.c @@ -242,6 +242,55 @@ end: return ret; } +static void show_basic_help(void) +{ + puts("Usage: lttng [--group=GROUP] [--mi=TYPE] [--no-sessiond | --sessiond-path=PATH]"); + puts(" [--quiet | -v | -vv | -vvv] COMMAND [COMMAND OPTIONS]"); + puts(""); + puts("Available commands:"); + puts(""); + puts("Tracing sessions:"); + puts(" create " CONFIG_CMD_DESCR_CREATE); + puts(" destroy " CONFIG_CMD_DESCR_DESTROY); + puts(" load " CONFIG_CMD_DESCR_LOAD); + puts(" metadata " CONFIG_CMD_DESCR_METADATA); + puts(" save " CONFIG_CMD_DESCR_SAVE); + puts(" set-session " CONFIG_CMD_DESCR_SET_SESSION); + puts(""); + puts("Channels:"); + puts(" add-context " CONFIG_CMD_DESCR_ADD_CONTEXT); + puts(" disable-channel " CONFIG_CMD_DESCR_DISABLE_CHANNEL); + puts(" enable-channel " CONFIG_CMD_DESCR_ENABLE_CHANNEL); + puts(""); + puts("Event rules:"); + puts(" disable-event " CONFIG_CMD_DESCR_DISABLE_EVENT); + puts(" enable-event " CONFIG_CMD_DESCR_ENABLE_EVENT); + puts(""); + puts("Status:"); + puts(" list " CONFIG_CMD_DESCR_LIST); + puts(" status " CONFIG_CMD_DESCR_STATUS); + puts(""); + puts("Control:"); + puts(" snapshot " CONFIG_CMD_DESCR_SNAPSHOT); + puts(" start " CONFIG_CMD_DESCR_START); + puts(" stop " CONFIG_CMD_DESCR_STOP); + puts(""); + puts("Resource tracking:"); + puts(" track " CONFIG_CMD_DESCR_TRACK); + puts(" untrack " CONFIG_CMD_DESCR_UNTRACK); + puts(""); + puts("Miscellaneous:"); + puts(" calibrate " CONFIG_CMD_DESCR_CALIBRATE); + puts(" help " CONFIG_CMD_DESCR_HELP); + puts(" version " CONFIG_CMD_DESCR_VERSION); + puts(" view " CONFIG_CMD_DESCR_VIEW); + puts(""); + puts("Run `lttng help COMMAND` or `lttng COMMAND --help` to get help with"); + puts("command COMMAND."); + puts(""); + puts("See `man lttng` for more help with the lttng command."); +} + /* * Parse command line arguments. * @@ -258,6 +307,7 @@ static int parse_args(int argc, char **argv) } if (argc < 2) { + show_basic_help(); clean_exit(EXIT_FAILURE); }