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 /res/res_sorcery_memory_cache.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 'res/res_sorcery_memory_cache.c')
-rw-r--r-- | res/res_sorcery_memory_cache.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/res/res_sorcery_memory_cache.c b/res/res_sorcery_memory_cache.c index 5f7ffb64e..bf2347ccd 100644 --- a/res/res_sorcery_memory_cache.c +++ b/res/res_sorcery_memory_cache.c @@ -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); |