diff options
author | Sean Bright <sean.bright@gmail.com> | 2017-02-11 10:57:03 -0500 |
---|---|---|
committer | Sean Bright <sean.bright@gmail.com> | 2017-02-13 11:33:15 -0500 |
commit | 3f9437377809a8c1476a1195474eb3178b2c7934 (patch) | |
tree | 74fd534bc18dcbaf3c7f13d561d647b24899a87d /channels/chan_skinny.c | |
parent | 5780492cd725858628c32b42d72152455f2525c3 (diff) |
cli: Fix various CLI documentation and completion issues
* app_minivm: Use built-in completion facilities to complete optional
arguments.
* app_voicemail: Use built-in completion facilities to complete
optional arguments.
* app_confbridge: Add missing colons after 'Usage' text.
* chan_alsa: Use built-in completion facilities to complete optional
arguments.
* chan_sip: Use built-in completion facilities to complete optional
arguments. Add completions for 'load' for 'sip show user', 'sip show
peer', and 'sip qualify peer.'
* chan_skinny: Correct and extend completions for 'skinny reset' and
'skinny show line.'
* func_odbc: Correct completions for 'odbc read' and 'odbc write'
* main/astmm: Use built-in completion facilities to complete arguments
for 'memory' commands.
* main/bridge: Correct completions for 'bridge kick.'
* main/ccss: Use built-in completion facilities to complete arguments
for 'cc cancel' command.
* main/cli: Add 'all' completion for 'channel request hangup.' Correct
completions for 'core set debug channel.' Correct completions for 'core
show calls.'
* main/pbx_app: Remove redundant completions for 'core show
applications.'
* main/pbx_hangup_handler: Remove unused completions for 'core show
hanguphandlers all.'
* res_sorcery_memory_cache: Add completion for 'reload' argument of
'sorcery memory cache stale' and properly implement.
Change-Id: Iee58c7392f6fec34ad9d596109117af87697bbca
Diffstat (limited to 'channels/chan_skinny.c')
-rw-r--r-- | channels/chan_skinny.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 0ef016635..a3a2f87fb 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -3921,24 +3921,40 @@ static char *complete_skinny_show_device(const char *line, const char *word, int static char *complete_skinny_reset(const char *line, const char *word, int pos, int state) { - return (pos == 2 ? complete_skinny_devices(word, state) : NULL); + if (pos == 2) { + static const char * const completions[] = { "all", NULL }; + char *ret = ast_cli_complete(word, completions, state); + if (!ret) { + ret = complete_skinny_devices(word, state - 1); + } + return ret; + } else if (pos == 3) { + static const char * const completions[] = { "restart", NULL }; + return ast_cli_complete(word, completions, state); + } + + return NULL; } static char *complete_skinny_show_line(const char *line, const char *word, int pos, int state) { - struct skinny_device *d; - struct skinny_line *l; - int wordlen = strlen(word), which = 0; + if (pos == 3) { + struct skinny_device *d; + struct skinny_line *l; + int wordlen = strlen(word), which = 0; - if (pos != 3) - return NULL; - - AST_LIST_TRAVERSE(&devices, d, list) { - AST_LIST_TRAVERSE(&d->lines, l, list) { - if (!strncasecmp(word, l->name, wordlen) && ++which > state) { - return ast_strdup(l->name); + AST_LIST_TRAVERSE(&devices, d, list) { + AST_LIST_TRAVERSE(&d->lines, l, list) { + if (!strncasecmp(word, l->name, wordlen) && ++which > state) { + return ast_strdup(l->name); + } } } + } else if (pos == 4) { + static const char * const completions[] = { "on", NULL }; + return ast_cli_complete(word, completions, state); + } else if (pos == 5) { + return complete_skinny_devices(word, state); } return NULL; @@ -4580,7 +4596,7 @@ static char *handle_skinny_show_line(struct ast_cli_entry *e, int cmd, struct as case CLI_INIT: e->command = "skinny show line"; e->usage = - "Usage: skinny show line <Line> [ on <DeviceID|DeviceName> ]\n" + "Usage: skinny show line <Line> [on <DeviceID|DeviceName>]\n" " List all lineinformation of a specific line known to the Skinny subsystem.\n"; return NULL; case CLI_GENERATE: |