add inline lists for tab complete db using ::[a:b syntax
This commit is contained in:
parent
07ec7867db
commit
445731eea1
|
@ -4618,8 +4618,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
|
|||
switch_console_set_complete("add sofia help");
|
||||
switch_console_set_complete("add sofia status");
|
||||
switch_console_set_complete("add sofia xmlstatus");
|
||||
switch_console_set_complete("add sofia loglevel");
|
||||
switch_console_set_complete("add sofia tracelevel");
|
||||
|
||||
switch_console_set_complete("add sofia loglevel ::[all:default:tport:iptsec:nea:nta:nth_client:nth_server:nua:soa:sresolv:stun ::[0:1:2:3:4:5:6:7:8:9");
|
||||
switch_console_set_complete("add sofia tracelevel ::[console:alert:crit:err:warning:notice:info:debug");
|
||||
|
||||
switch_console_set_complete("add sofia profile");
|
||||
switch_console_set_complete("add sofia profile restart all");
|
||||
|
||||
|
|
|
@ -483,9 +483,29 @@ static int comp_callback(void *pArg, int argc, char **argv, char **columnNames)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!zstr(target) && *target == ':' && *(target + 1) == ':' && *(target + 2) == '[') {
|
||||
char *p = target + 3, *list = NULL;
|
||||
|
||||
if (p) {
|
||||
char *argv[100] = { 0 };
|
||||
char *r_argv[1] = { 0 }, *r_cols[1] = {0};
|
||||
list = strdup(p);
|
||||
|
||||
argc = switch_separate_string(list, ':', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (!cur || !strncmp(argv[i], cur, strlen(cur))) {
|
||||
r_argv[0] = argv[i];
|
||||
comp_callback(h, 1, r_argv, r_cols);
|
||||
}
|
||||
}
|
||||
switch_safe_free(list);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!zstr(target) && *target == ':' && *(target + 1) == ':') {
|
||||
char *r_argv[1] = { 0 }, *r_cols[1] = {
|
||||
0};
|
||||
char *r_argv[1] = { 0 }, *r_cols[1] = {0};
|
||||
switch_console_callback_match_t *matches;
|
||||
if (switch_console_run_complete_func(target, str, cur, &matches) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_callback_match_node_t *m;
|
||||
|
@ -797,6 +817,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch
|
|||
}
|
||||
|
||||
stream.write_function(&stream, " and hostname='%s' order by a%d", switch_core_get_variable("hostname"), h.words + 1);
|
||||
|
||||
switch_cache_db_execute_sql_callback(db, stream.data, comp_callback, &h, &errmsg);
|
||||
|
||||
if (errmsg) {
|
||||
|
|
Loading…
Reference in New Issue