mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
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:
@@ -1064,35 +1064,30 @@ static char *handle_clear_profile(struct ast_cli_entry *e, int cmd, struct ast_c
|
||||
static char *handle_show_version_files(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
#define FORMAT "%-25.25s %-40.40s\n"
|
||||
static const char * const completions[] = { "like", NULL };
|
||||
struct registered_file *iterator;
|
||||
regex_t regexbuf;
|
||||
int havepattern = 0;
|
||||
int havename = 0;
|
||||
int count_files = 0;
|
||||
char *ret = NULL;
|
||||
int matchlen, which = 0;
|
||||
struct registered_file *find;
|
||||
|
||||
switch (cmd) {
|
||||
case CLI_INIT:
|
||||
e->command = "core show file version [like]";
|
||||
e->command = "core show file version";
|
||||
e->usage =
|
||||
"Usage: core show file version [like <pattern>]\n"
|
||||
"Usage: core show file version [<filename>|like <pattern>]\n"
|
||||
" Lists the files along with the Asterisk version.\n"
|
||||
" Optional regular expression pattern is used to filter the file list.\n";
|
||||
return NULL;
|
||||
case CLI_GENERATE:
|
||||
matchlen = strlen(a->word);
|
||||
if (a->pos != 3)
|
||||
if (a->pos != 4) {
|
||||
return NULL;
|
||||
AST_RWLIST_RDLOCK(®istered_files);
|
||||
AST_RWLIST_TRAVERSE(®istered_files, find, list) {
|
||||
if (!strncasecmp(a->word, find->file, matchlen) && ++which > a->n) {
|
||||
ret = ast_strdup(find->file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
AST_RWLIST_UNLOCK(®istered_files);
|
||||
ret = ast_cli_complete(a->word, completions, a->n);
|
||||
if (!ret) {
|
||||
ret = ast_complete_source_filename(a->word, a->n - 1);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1107,6 +1102,9 @@ static char *handle_show_version_files(struct ast_cli_entry *e, int cmd, struct
|
||||
return CLI_SHOWUSAGE;
|
||||
break;
|
||||
case 5:
|
||||
if (!strcasecmp(a->argv[4], "like")) {
|
||||
return CLI_SHOWUSAGE;
|
||||
}
|
||||
havename = 1;
|
||||
break;
|
||||
case 4:
|
||||
|
Reference in New Issue
Block a user