Add /executable command
This is used to set the openers for various commands. So far for /avatar and /urlopen.
This commit is contained in:
@@ -124,6 +124,7 @@ static char* _correction_autocomplete(ProfWin *window, const char *const input,
|
||||
static char* _correct_autocomplete(ProfWin *window, const char *const input, gboolean previous);
|
||||
static char* _software_autocomplete(ProfWin *window, const char *const input, gboolean previous);
|
||||
static char* _urlopen_autocomplete(ProfWin *window, const char *const input, gboolean previous);
|
||||
static char* _executable_autocomplete(ProfWin *window, const char *const input, gboolean previous);
|
||||
|
||||
static char* _script_autocomplete_func(const char *const prefix, gboolean previous, void *context);
|
||||
|
||||
@@ -256,6 +257,7 @@ static Autocomplete logging_group_ac;
|
||||
static Autocomplete color_ac;
|
||||
static Autocomplete correction_ac;
|
||||
static Autocomplete avatar_ac;
|
||||
static Autocomplete executable_ac;
|
||||
|
||||
void
|
||||
cmd_ac_init(void)
|
||||
@@ -988,8 +990,11 @@ cmd_ac_init(void)
|
||||
|
||||
avatar_ac = autocomplete_new();
|
||||
autocomplete_add(avatar_ac, "get");
|
||||
autocomplete_add(avatar_ac, "cmd");
|
||||
autocomplete_add(avatar_ac, "open");
|
||||
|
||||
executable_ac = autocomplete_new();
|
||||
autocomplete_add(executable_ac, "avatar");
|
||||
autocomplete_add(executable_ac, "urlopen");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1306,6 +1311,7 @@ cmd_ac_reset(ProfWin *window)
|
||||
autocomplete_reset(color_ac);
|
||||
autocomplete_reset(correction_ac);
|
||||
autocomplete_reset(avatar_ac);
|
||||
autocomplete_reset(executable_ac);
|
||||
|
||||
autocomplete_reset(script_ac);
|
||||
if (script_show_ac) {
|
||||
@@ -1464,6 +1470,7 @@ cmd_ac_uninit(void)
|
||||
autocomplete_free(color_ac);
|
||||
autocomplete_free(correction_ac);
|
||||
autocomplete_free(avatar_ac);
|
||||
autocomplete_free(executable_ac);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1724,6 +1731,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previ
|
||||
g_hash_table_insert(ac_funcs, "/correct", _correct_autocomplete);
|
||||
g_hash_table_insert(ac_funcs, "/software", _software_autocomplete);
|
||||
g_hash_table_insert(ac_funcs, "/urlopen", _urlopen_autocomplete);
|
||||
g_hash_table_insert(ac_funcs, "/executable", _executable_autocomplete);
|
||||
|
||||
int len = strlen(input);
|
||||
char parsed[len+1];
|
||||
@@ -3930,3 +3938,15 @@ _urlopen_autocomplete(ProfWin *window, const char *const input, gboolean previou
|
||||
return result;
|
||||
}
|
||||
|
||||
static char*
|
||||
_executable_autocomplete(ProfWin *window, const char *const input, gboolean previous)
|
||||
{
|
||||
char *result = NULL;
|
||||
|
||||
result = autocomplete_param_with_ac(input, "/executable", executable_ac, TRUE, previous);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user