diff options
author | Harpreet Kaur Lalwani <hlalwani@redhat.com> | 2018-11-21 16:13:36 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-12-04 09:28:11 +0000 |
commit | 8e8f4bf3fa16d3790a5eb74b8f07b904024ee9d8 (patch) | |
tree | 33f13742f00e9872940a2cd1a1f163ccc6c25a9e /cli/src/cli-cmd.c | |
parent | 54ebd47e4154c8b37680b2bac43775fc92ced153 (diff) |
cli: "usage()" and "--help" for gluster cli
Added a usage message which will be shown when a user enters an
"unrecognized word" or an "unrecognized command" on the cli.
Also added a "--help" option for gluster cli.
fixes: bz#1535495
Change-Id: Ibcfb3d1c84daa1054e09c5cdfa6a5dab19f534a6
Signed-off-by: Harpreet Kaur Lalwani <hlalwani@redhat.com>
Diffstat (limited to 'cli/src/cli-cmd.c')
-rw-r--r-- | cli/src/cli-cmd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c index 396cabebbbe..2ee8b1b4968 100644 --- a/cli/src/cli-cmd.c +++ b/cli/src/cli-cmd.c @@ -108,12 +108,14 @@ cli_cmd_process(struct cli_state *state, int argc, char **argv) } if (!word) { - cli_out("unrecognized word: %s (position %d)", argv[i], i); + cli_out("unrecognized word: %s (position %d)\n", argv[i], i); + usage(); return -1; } if (!word->cbkfn) { - cli_out("unrecognized command"); + cli_out("unrecognized command\n"); + usage(); return -1; } |