mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-14 16:33:34 +00:00
main/translate: Use ast_cli_completion_add.
Change-Id: I0e2402660e54d91f74ab0804c62a5b1925577413
This commit is contained in:
@@ -900,9 +900,9 @@ const char *ast_translate_path_to_str(struct ast_trans_pvt *p, struct ast_str **
|
|||||||
return ast_str_buffer(*str);
|
return ast_str_buffer(*str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *complete_trans_path_choice(const char *line, const char *word, int pos, int state)
|
static char *complete_trans_path_choice(const char *word)
|
||||||
{
|
{
|
||||||
int i = 1, which = 0;
|
int i = 1;
|
||||||
int wordlen = strlen(word);
|
int wordlen = strlen(word);
|
||||||
struct ast_codec *codec;
|
struct ast_codec *codec;
|
||||||
|
|
||||||
@@ -912,13 +912,15 @@ static char *complete_trans_path_choice(const char *line, const char *word, int
|
|||||||
ao2_ref(codec, -1);
|
ao2_ref(codec, -1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strncasecmp(word, codec->name, wordlen) && ++which > state) {
|
if (!strncasecmp(word, codec->name, wordlen)) {
|
||||||
char *res = ast_strdup(codec->name);
|
if (ast_cli_completion_add(ast_strdup(codec->name))) {
|
||||||
ao2_ref(codec, -1);
|
ao2_ref(codec, -1);
|
||||||
return res;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ao2_ref(codec, -1);
|
ao2_ref(codec, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1138,10 +1140,10 @@ static char *handle_cli_core_show_translation(struct ast_cli_entry *e, int cmd,
|
|||||||
return NULL;
|
return NULL;
|
||||||
case CLI_GENERATE:
|
case CLI_GENERATE:
|
||||||
if (a->pos == 3) {
|
if (a->pos == 3) {
|
||||||
return ast_cli_complete(a->word, option, a->n);
|
return ast_cli_complete(a->word, option, -1);
|
||||||
}
|
}
|
||||||
if (a->pos == 4 && !strcasecmp(a->argv[3], option[1])) {
|
if (a->pos == 4 && !strcasecmp(a->argv[3], option[1])) {
|
||||||
return complete_trans_path_choice(a->line, a->word, a->pos, a->n);
|
return complete_trans_path_choice(a->word);
|
||||||
}
|
}
|
||||||
/* BUGBUG - add tab completion for sample rates */
|
/* BUGBUG - add tab completion for sample rates */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Reference in New Issue
Block a user