summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-03-19 20:45:22 +0100
committerSébastien Helleu <flashcode@flashtux.org>2024-03-19 20:45:22 +0100
commit762d71012a8f83d20c1bf907ba6d4d32fbea768f (patch)
tree9db2a0e46ec70bf66385727bd2e20586779e8a8e /src
parent7aa5d718a8d272560addb4282e12d5e43898e179 (diff)
downloadweechat-762d71012a8f83d20c1bf907ba6d4d32fbea768f.zip
script: add option `enable` in command `/script`, improve error displayed when download of scripts is disabled
Diffstat (limited to 'src')
-rw-r--r--src/plugins/script/script-command.c20
-rw-r--r--src/plugins/script/script.c2
2 files changed, 19 insertions, 3 deletions
diff --git a/src/plugins/script/script-command.c b/src/plugins/script/script-command.c
index 71358ef86..3d207f8cd 100644
--- a/src/plugins/script/script-command.c
+++ b/src/plugins/script/script-command.c
@@ -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)|%*"
diff --git a/src/plugins/script/script.c b/src/plugins/script/script.c
index ab4e8b92d..da9510788 100644
--- a/src/plugins/script/script.c
+++ b/src/plugins/script/script.c
@@ -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);
}