return ast_module_helper(line, word, pos, state, 3, 0);
}
-static char *complete_fn(const char *line, const char *word, int pos, int state)
+static char *complete_fn_2(const char *line, const char *word, int pos, int state)
{
char *c;
char filename[256];
return c ? strdup(c) : c;
}
+static char *complete_fn_3(const char *line, const char *word, int pos, int state)
+{
+ char *c;
+ char filename[256];
+
+ if (pos != 2)
+ return NULL;
+
+ if (word[0] == '/')
+ ast_copy_string(filename, word, sizeof(filename));
+ else
+ snprintf(filename, sizeof(filename), "%s/%s", ast_config_AST_MODULE_DIR, word);
+
+ c = filename_completion_function(filename, state);
+
+ if (c && word[0] != '/')
+ c += (strlen(ast_config_AST_MODULE_DIR) + 1);
+
+ return c ? strdup(c) : c;
+}
+
static int group_show_channels(int fd, int argc, char *argv[])
{
#define FORMAT_STRING "%-25s %-20s %-20s\n"
static struct ast_cli_entry cli_module_load_deprecated = {
{ "load", NULL },
handle_load_deprecated, NULL,
- NULL, complete_fn };
+ NULL, complete_fn_2 };
static struct ast_cli_entry cli_module_reload_deprecated = {
{ "reload", NULL },
{ { "module", "load", NULL },
handle_load, "Load a module by name",
- load_help, complete_fn, &cli_module_load_deprecated },
+ load_help, complete_fn_3, &cli_module_load_deprecated },
{ { "module", "reload", NULL },
handle_reload, "Reload configuration",