bowl over previous commit that nearly conflicted out 2 hours of coding (grrr) hook new complete api up to FSAPI and export tab completion down to fs_cli

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15956 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2009-12-15 00:19:30 +00:00
1 parent ed317e3d4a
commit a0479189b2
3 files changed
+80 -1

No files matched your search

+2 -1
View File
@@ -82,9 +82,10 @@ SWITCH_DECLARE(switch_status_t) switch_console_shutdown(void);
SWITCH_DECLARE(switch_status_t) switch_console_add_complete_func(const char *name, switch_console_complete_callback_t cb);
SWITCH_DECLARE(switch_status_t) switch_console_del_complete_func(const char *name);
SWITCH_DECLARE(switch_status_t) switch_console_run_complete_func(const char *func, const char *line,
const char *cursor, switch_console_callback_match_t **matches);
const char *last_word, switch_console_callback_match_t **matches);
SWITCH_DECLARE(void) switch_console_push_match(switch_console_callback_match_t **matches, const char *new_val);
SWITCH_DECLARE(void) switch_console_free_matches(switch_console_callback_match_t **matches);
SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const char *last_word, FILE *console_out, switch_stream_handle_t *stream);
SWITCH_END_EXTERN_C
#endif
@@ -767,6 +767,28 @@ SWITCH_STANDARD_API(expand_function)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_API(console_complete_function)
{
const char *p, *cursor = NULL;
int c;
if (zstr(cmd)) {
cmd = " ";
}
if ((p = strstr(cmd, "c="))) {
p += 2;
c = atoi(p);
if ((p = strchr(p, ';'))) {
cmd = p + 1;
cursor = cmd + c;
}
}
switch_console_complete(cmd, cursor, NULL, stream);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_API(eval_function)
{
@@ -3791,6 +3813,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
SWITCH_ADD_API(commands_api_interface, "break", "Break", break_function, BREAK_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "complete", "Complete", complete_function, COMPLETE_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "cond", "Eval a conditional", cond_function, "<expr> ? <true val> : <false val>");
SWITCH_ADD_API(commands_api_interface, "console_complete", "", console_complete_function, "<line>");
SWITCH_ADD_API(commands_api_interface, "create_uuid", "Create a uuid", uuid_function, UUID_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "db_cache", "db cache management", db_cache_function, "status");
SWITCH_ADD_API(commands_api_interface, "domain_exists", "check if a domain exists", domain_exists_function, "<domain>");