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/asterisk: Correct and extend completions for 'core show file
version.'

* 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
This commit is contained in:
Sean Bright
2017-02-11 10:57:03 -05:00
parent c7fcc4468f
commit ea8a610776
15 changed files with 129 additions and 110 deletions

View File

@@ -1866,6 +1866,7 @@ static char *sorcery_memory_cache_expire(struct ast_cli_entry *e, int cmd, struc
static char *sorcery_memory_cache_stale(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct sorcery_memory_cache *cache;
int reload = 0;
switch (cmd) {
case CLI_INIT:
@@ -1881,6 +1882,9 @@ static char *sorcery_memory_cache_stale(struct ast_cli_entry *e, int cmd, struct
return sorcery_memory_cache_complete_name(a->word, a->n);
} else if (a->pos == 5) {
return sorcery_memory_cache_complete_object_name(a->argv[4], a->word, a->n);
} else if (a->pos == 6) {
static const char * const completions[] = { "reload", NULL };
return ast_cli_complete(a->word, completions, a->n);
} else {
return NULL;
}
@@ -1890,6 +1894,14 @@ static char *sorcery_memory_cache_stale(struct ast_cli_entry *e, int cmd, struct
return CLI_SHOWUSAGE;
}
if (a->argc == 7) {
if (!strcasecmp(a->argv[6], "reload")) {
reload = 1;
} else {
return CLI_SHOWUSAGE;
}
}
cache = ao2_find(caches, a->argv[4], OBJ_SEARCH_KEY);
if (!cache) {
ast_cli(a->fd, "Specified sorcery memory cache '%s' does not exist\n", a->argv[4]);
@@ -1910,7 +1922,7 @@ static char *sorcery_memory_cache_stale(struct ast_cli_entry *e, int cmd, struct
if (!mark_object_as_stale_in_cache(cache, a->argv[5])) {
ast_cli(a->fd, "Successfully marked object '%s' in memory cache '%s' as stale\n",
a->argv[5], a->argv[4]);
if (a->argc == 7 && ast_true(a->argv[6])) {
if (reload) {
struct sorcery_memory_cached_object *cached;
cached = ao2_find(cache->objects, a->argv[5], OBJ_SEARCH_KEY | OBJ_NOLOCK);