1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 04:46:37 +02:00

script: add option enable in command /script, improve error displayed when download of scripts is disabled

This commit is contained in:
Sébastien Helleu
2024-03-19 20:45:22 +01:00
parent 7aa5d718a8
commit 762d71012a
17 changed files with 333 additions and 162 deletions
+18 -2
View File
@@ -154,6 +154,18 @@ script_command_script (const void *pointer, void *data,
return WEECHAT_RC_OK;
}
if (weechat_strcmp (argv[1], "enable") == 0)
{
if (!weechat_config_boolean (script_config_scripts_download_enabled))
{
weechat_config_option_set (script_config_scripts_download_enabled, "on", 1);
weechat_printf (NULL,
_("%s: download of scripts enabled"),
SCRIPT_PLUGIN_NAME);
}
return WEECHAT_RC_OK;
}
if (weechat_strcmp (argv[1], "list") == 0)
{
script_action_schedule (buffer, argv_eol[1], 1, 0, 0);
@@ -309,7 +321,8 @@ script_command_init ()
"script",
N_("WeeChat script manager"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("list [-o|-ol|-i|-il]"
N_("enable"
" || list [-o|-ol|-i|-il]"
" || search <text>"
" || show <script>"
" || load|unload|reload <script> [<script>...]"
@@ -320,6 +333,8 @@ script_command_init ()
" || -up|-down [<number>]"
" || -go <line>|end"),
WEECHAT_CMD_ARGS_DESC(
N_("raw[enable]: enable download of scripts "
"(turn on option script.scripts.download_enabled)"),
N_("raw[list]: list loaded scripts (all languages)"),
N_("raw[-o]: send list of loaded scripts to buffer "
"(string in English)"),
@@ -380,7 +395,8 @@ script_command_init ()
AI(" /script hold urlserver.py"),
AI(" /script reload urlserver"),
AI(" /script upgrade")),
"list -i|-il|-o|-ol"
"enable"
" || list -i|-il|-o|-ol"
" || search %(script_tags)|%(script_languages)|%(script_extensions)"
" || show %(script_scripts)"
" || load %(script_files)|%*"
+1 -1
View File
@@ -123,7 +123,7 @@ script_download_enabled (int display_error)
/* download not enabled: display an error */
weechat_printf (NULL,
_("%s%s: download of scripts is disabled by default; "
"see /help script.scripts.download_enabled"),
"to enable it, type /script enable"),
weechat_prefix ("error"),
SCRIPT_PLUGIN_NAME);
}