standardize "module show [like]"

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47815 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo
2006-11-17 22:02:15 +00:00
parent 54d44e9b00
commit 619c4ef0ec

View File

@@ -425,7 +425,7 @@ static char *handle_modlist(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
switch (cmd) { switch (cmd) {
case CLI_INIT: case CLI_INIT:
e->command = "module show"; e->command = "module show [like]";
e->usage = e->usage =
"Usage: module show [like keyword]\n" "Usage: module show [like keyword]\n"
" Shows Asterisk modules currently in use, and usage statistics.\n"; " Shows Asterisk modules currently in use, and usage statistics.\n";
@@ -433,8 +433,6 @@ static char *handle_modlist(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
case CLI_GENERATE: case CLI_GENERATE:
if (a->pos == e->args) if (a->pos == e->args)
return a->n == 0 ? strdup("like") : NULL;
else if (a->pos == e->args+1 && strcasestr(a->line," like "))
return ast_module_helper(a->line, a->word, a->pos, a->n, a->pos, 0); return ast_module_helper(a->line, a->word, a->pos, a->n, a->pos, 0);
else else
return NULL; return NULL;
@@ -442,10 +440,10 @@ static char *handle_modlist(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
/* all the above return, so we proceed with the handler. /* all the above return, so we proceed with the handler.
* we are guaranteed to have argc >= e->args * we are guaranteed to have argc >= e->args
*/ */
if (a->argc == e->args) if (a->argc == e->args - 1)
like = ""; like = "";
else if (a->argc == e->args + 2 && !strcmp(a->argv[e->args],"like")) else if (a->argc == e->args + 1 && !strcasecmp(a->argv[e->args-1], "like") )
like = a->argv[e->args + 1]; like = a->argv[e->args];
else else
return CLI_SHOWUSAGE; return CLI_SHOWUSAGE;