mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Merge "cli: Fix various CLI documentation and completion issues" into 13
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user