1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 06:25:41 +02:00

script: add control of autoload (enable/disable/toggle) (task #12393)

New option script.scripts.autoload, new options autoload/noautoload/toggleautoload
for command /script, new action "A" (meta-A) on script buffer (toggle autoload).
This commit is contained in:
Sebastien Helleu
2013-02-25 08:46:41 +01:00
parent 87b5096972
commit b60aec975b
35 changed files with 1227 additions and 535 deletions
File diff suppressed because it is too large Load Diff
+23 -21
View File
@@ -510,9 +510,9 @@ script_buffer_refresh (int clear)
snprintf (str_title, sizeof (str_title),
_("%d/%d scripts (filter: %s) | Sort: %s | "
"Alt+key/input: i=install r=remove l=load L=reload "
"u=unload h=(un)hold v=view script | Input: q=close "
"$=refresh s:x,y=sort words=filter *=reset filter | "
"Mouse: left=select right=install/remove"),
"u=unload A=autoload h=(un)hold v=view script | "
"Input: q=close $=refresh s:x,y=sort words=filter "
"*=reset filter | Mouse: left=select right=install/remove"),
script_repo_count_displayed,
script_repo_count,
(script_repo_filter) ? script_repo_filter : "*",
@@ -706,15 +706,16 @@ int
script_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data)
{
char *actions[][2] = { { "l", "load" },
{ "u", "unload" },
{ "L", "reload" },
{ "i", "install" },
{ "r", "remove" },
{ "h", "hold" },
{ "v", "show" },
{ "d", "showdiff" },
{ NULL, NULL } };
char *actions[][2] = { { "A", "toggleautoload" },
{ "l", "load" },
{ "u", "unload" },
{ "L", "reload" },
{ "i", "install" },
{ "r", "remove" },
{ "h", "hold" },
{ "v", "show" },
{ "d", "showdiff" },
{ NULL, NULL } };
char str_command[64];
int i;
@@ -814,15 +815,16 @@ script_buffer_set_callbacks ()
void
script_buffer_set_keys ()
{
char *keys[][2] = { { "meta-l", "load" },
{ "meta-u", "unload" },
{ "meta-L", "reload" },
{ "meta-i", "install" },
{ "meta-r", "remove" },
{ "meta-h", "hold" },
{ "meta-v", "show" },
{ "meta-d", "showdiff" },
{ NULL, NULL } };
char *keys[][2] = { { "meta-A", "toggleautoload" },
{ "meta-l", "load" },
{ "meta-u", "unload" },
{ "meta-L", "reload" },
{ "meta-i", "install" },
{ "meta-r", "remove" },
{ "meta-h", "hold" },
{ "meta-v", "show" },
{ "meta-d", "showdiff" },
{ NULL, NULL } };
char str_key[64], str_command[64];
int i;
+26 -16
View File
@@ -169,7 +169,10 @@ script_command_script (void *data, struct t_gui_buffer *buffer, int argc,
if ((weechat_strcasecmp (argv[1], "load") == 0)
|| (weechat_strcasecmp (argv[1], "unload") == 0)
|| (weechat_strcasecmp (argv[1], "reload") == 0))
|| (weechat_strcasecmp (argv[1], "reload") == 0)
|| (weechat_strcasecmp (argv[1], "autoload") == 0)
|| (weechat_strcasecmp (argv[1], "noautoload") == 0)
|| (weechat_strcasecmp (argv[1], "toggleautoload") == 0))
{
script_command_action (buffer,
argv[1],
@@ -264,29 +267,33 @@ script_command_init ()
N_("WeeChat scripts manager"),
N_("list [-o|-i] || search <text> || show <script>"
" || load|unload|reload <script> [<script>...]"
" || autoload|noautoload|toggleautoload <script> [<script>...]"
" || install|remove|installremove|hold [-q] <script> [<script>...]"
" || upgrade || update"),
N_(" list: list loaded scripts (all languages)\n"
" -o: send list of loaded scripts to buffer\n"
" -i: copy list of loaded scripts in "
N_(" list: list loaded scripts (all languages)\n"
" -o: send list of loaded scripts to buffer\n"
" -i: copy list of loaded scripts in "
"command line (for sending to buffer)\n"
" search: search scripts by tags or text and "
" search: search scripts by tags or text and "
"display result on scripts buffer\n"
" show: show detailed info about a script\n"
" load: load script(s)\n"
" unload: unload script(s)\n"
" reload: reload script(s)\n"
" install: install/upgrade script(s)\n"
" remove: remove script(s)\n"
"installremove: install or remove script(s), "
" show: show detailed info about a script\n"
" load: load script(s)\n"
" unload: unload script(s)\n"
" reload: reload script(s)\n"
" autoload: autoload the script\n"
" noautoload: do not autoload the script\n"
"toggleautoload: toggle autoload\n"
" install: install/upgrade script(s)\n"
" remove: remove script(s)\n"
" installremove: install or remove script(s), "
"depending on current state\n"
" hold: hold/unhold script(s) (a script held "
" hold: hold/unhold script(s) (a script held "
"will not be upgraded any more and cannot be "
"removed)\n"
" -q: quiet mode: do not display messages\n"
" upgrade: upgrade all installed scripts which "
" -q: quiet mode: do not display messages\n"
" upgrade: upgrade all installed scripts which "
"are obsolete (new version available)\n"
" update: update local scripts cache\n\n"
" update: update local scripts cache\n\n"
"Without argument, this command opens a buffer "
"with list of scripts.\n\n"
"On script buffer, the possible status for each "
@@ -338,6 +345,9 @@ script_command_init ()
" || reload %(python_script)|%(perl_script)|"
"%(ruby_script)|%(tcl_script)|%(lua_script)|"
"%(guile_script)|%*"
" || autoload %(script_scripts_installed)|%*"
" || noautoload %(script_scripts_installed)|%*"
" || toggleautoload %(script_scripts_installed)|%*"
" || install %(script_scripts)|%*"
" || remove %(script_scripts_installed)|%*"
" || installremove %(script_scripts)|%*"
+8
View File
@@ -80,6 +80,7 @@ struct t_config_option *script_config_color_text_bg_selected;
/* script config, scripts section */
struct t_config_option *script_config_scripts_autoload;
struct t_config_option *script_config_scripts_cache_expire;
struct t_config_option *script_config_scripts_dir;
struct t_config_option *script_config_scripts_hold;
@@ -670,6 +671,13 @@ script_config_init ()
return 0;
}
script_config_scripts_autoload = weechat_config_new_option (
script_config_file, ptr_section,
"autoload", "boolean",
N_("autoload scripts installed (make a link in \"autoload\" directory "
"to script in parent directory"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
script_config_scripts_cache_expire = weechat_config_new_option (
script_config_file, ptr_section,
"cache_expire", "integer",
+1
View File
@@ -60,6 +60,7 @@ extern struct t_config_option *script_config_color_text_version_selected;
extern struct t_config_option *script_config_color_text_version_loaded_selected;
extern struct t_config_option *script_config_color_text_bg_selected;
extern struct t_config_option *script_config_scripts_autoload;
extern struct t_config_option *script_config_scripts_cache_expire;
extern struct t_config_option *script_config_scripts_dir;
extern struct t_config_option *script_config_scripts_hold;