diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/script/script-command.c | 2 | ||||
-rw-r--r-- | src/plugins/script/script-completion.c | 58 | ||||
-rw-r--r-- | src/plugins/script/script-repo.c | 22 |
3 files changed, 80 insertions, 2 deletions
diff --git a/src/plugins/script/script-command.c b/src/plugins/script/script-command.c index 164ec55a6..8caabdc20 100644 --- a/src/plugins/script/script-command.c +++ b/src/plugins/script/script-command.c @@ -366,7 +366,7 @@ script_command_init () " /script reload urlserver\n" " /script upgrade"), "list -o|-i" - " || search %(script_tags)" + " || search %(script_tags)|%(script_languages)|%(script_extensions)" " || show %(script_scripts)" " || load %(script_files)|%*" " || unload %(python_script)|%(perl_script)|%(ruby_script)|" diff --git a/src/plugins/script/script-completion.c b/src/plugins/script/script-completion.c index 16749c56e..50d2e65fe 100644 --- a/src/plugins/script/script-completion.c +++ b/src/plugins/script/script-completion.c @@ -30,6 +30,58 @@ /* + * Adds script languages (python, perl, ruby, ...) to completion list. + */ + +int +script_completion_languages_cb (void *data, const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + int i; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (i = 0; i < SCRIPT_NUM_LANGUAGES; i++) + { + weechat_hook_completion_list_add (completion, + script_language[i], + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * Adds script extensions (py, pl, rb, ...) to completion list. + */ + +int +script_completion_extensions_cb (void *data, const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + int i; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (i = 0; i < SCRIPT_NUM_LANGUAGES; i++) + { + weechat_hook_completion_list_add (completion, + script_extension[i], + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* * Adds scripts to completion list. */ @@ -215,6 +267,12 @@ script_completion_tags_cb (void *data, const char *completion_item, void script_completion_init () { + weechat_hook_completion ("script_languages", + N_("list of script languages"), + &script_completion_languages_cb, NULL); + weechat_hook_completion ("script_extensions", + N_("list of script extensions"), + &script_completion_extensions_cb, NULL); weechat_hook_completion ("script_scripts", N_("list of scripts in repository"), &script_completion_scripts_cb, NULL); diff --git a/src/plugins/script/script-repo.c b/src/plugins/script/script-repo.c index bef5fad17..fed8473bd 100644 --- a/src/plugins/script/script-repo.c +++ b/src/plugins/script/script-repo.c @@ -948,13 +948,33 @@ script_repo_match_filter (struct t_script_repo *script) if (!has_tag) { match = 0; + if (script->name_with_extension - && weechat_strcasestr (script->name_with_extension, words[i])) + && weechat_strcasestr (script->name_with_extension, + words[i])) + { match = 1; + } + + if (!match + && (weechat_strcasecmp (script_language[script->language], + words[i]) == 0)) + { + match = 1; + } + + if (!match + && (weechat_strcasecmp (script_extension[script->language], + words[i]) == 0)) + { + match = 1; + } if (!match && script->description && weechat_strcasestr (script->description, words[i])) + { match = 1; + } if (!match) { |