blobcli: print usage when run without arguments

Previously, running blobcli with no arguments would just print
"ERROR: Invalid option" and exit; tweak the tests in usage() so the
command help gets printed in this case.

Change-Id: I70dbe82f2e83a6f068d4bd61c7baa9d2bbc6f829
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/398078
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2018-02-01 10:08:34 -07:00 committed by Jim Harris
parent cf9e099862
commit 7fc141712f

View File

@ -173,7 +173,7 @@ usage(struct cli_context_t *cli_context, char *msg)
printf("%s", msg);
}
if (cli_context && cli_context->cli_mode == CLI_MODE_CMD) {
if (!cli_context || cli_context->cli_mode == CLI_MODE_CMD) {
printf("Version %s\n", SPDK_VERSION_STRING);
printf("Usage: %s [-c SPDK config_file] Command\n", program_name);
printf("\n%s is a command line tool for interacting with blobstore\n",
@ -181,7 +181,7 @@ usage(struct cli_context_t *cli_context, char *msg)
printf("on the underlying device specified in the conf file passed\n");
printf("in as a command line option.\n");
}
if (cli_context && cli_context->cli_mode != CLI_MODE_SCRIPT) {
if (!cli_context || cli_context->cli_mode != CLI_MODE_SCRIPT) {
print_cmds();
}
}