summaryrefslogtreecommitdiff
path: root/main/cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/cli.c')
-rw-r--r--main/cli.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/main/cli.c b/main/cli.c
index 80c184328..5730be17b 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -148,11 +148,6 @@ unsigned int ast_debug_get_by_module(const char *module)
return res;
}
-unsigned int ast_verbose_get_by_module(const char *module)
-{
- return 0;
-}
-
/*! \internal
* \brief Check if the user with 'uid' and 'gid' is allow to execute 'command',
* if command starts with '_' then not check permissions, just permit
@@ -1655,8 +1650,15 @@ char *ast_cli_complete(const char *word, const char * const choices[], int state
len = ast_strlen_zero(word) ? 0 : strlen(word);
for (i = 0; choices[i]; i++) {
- if ((!len || !strncasecmp(word, choices[i], len)) && ++which > state)
- return ast_strdup(choices[i]);
+ if ((!len || !strncasecmp(word, choices[i], len)) && ++which > state) {
+ if (state != -1) {
+ return ast_strdup(choices[i]);
+ }
+
+ if (ast_cli_completion_add(ast_strdup(choices[i]))) {
+ return NULL;
+ }
+ }
}
return NULL;
}
@@ -1682,9 +1684,16 @@ char *ast_complete_channels(const char *line, const char *word, int pos, int sta
struct ast_channel_snapshot *snapshot = stasis_message_data(msg);
if (!strncasecmp(word, snapshot->name, wordlen) && (++which > state)) {
- ret = ast_strdup(snapshot->name);
- ao2_ref(msg, -1);
- break;
+ if (state != -1) {
+ ret = ast_strdup(snapshot->name);
+ ao2_ref(msg, -1);
+ break;
+ }
+
+ if (ast_cli_completion_add(ast_strdup(snapshot->name))) {
+ ao2_ref(msg, -1);
+ break;
+ }
}
}
ao2_iterator_destroy(&iter);