summaryrefslogtreecommitdiff
path: root/src/plugins/alias
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-05-27 20:20:31 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-05-27 20:20:31 +0200
commit193d2902852c637dfb9ac43830149848224dac10 (patch)
tree5b7c4400ad8f719bef6bc71f24f565ea50950df9 /src/plugins/alias
parent50f5be70aa449dede9289d9bae9b4fd121a3c330 (diff)
downloadweechat-193d2902852c637dfb9ac43830149848224dac10.zip
alias: add option `missing` in command `/alias`
Diffstat (limited to 'src/plugins/alias')
-rw-r--r--src/plugins/alias/alias-command.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/plugins/alias/alias-command.c b/src/plugins/alias/alias-command.c
index 260419916..50d5fd7f2 100644
--- a/src/plugins/alias/alias-command.c
+++ b/src/plugins/alias/alias-command.c
@@ -277,6 +277,20 @@ alias_command_cb (const void *pointer, void *data,
return WEECHAT_RC_OK;
}
+ if (weechat_strcmp (argv[1], "missing") == 0)
+ {
+ for (i = 0; alias_default[i][0]; i++)
+ {
+ if (!alias_search (alias_default[i][0]))
+ {
+ alias_command_add (alias_default[i][0], /* name */
+ alias_default[i][1], /* command */
+ alias_default[i][2]); /* completion */
+ }
+ }
+ return WEECHAT_RC_OK;
+ }
+
WEECHAT_COMMAND_ERROR;
}
@@ -294,7 +308,8 @@ alias_command_init ()
" || add <alias> [<command>[;<command>...]]"
" || addcompletion <completion> <alias> [<command>[;<command>...]]"
" || del <alias> [<alias>...]"
- " || rename <alias> <new_alias>"),
+ " || rename <alias> <new_alias>"
+ " || missing"),
/* xgettext:no-c-format */
N_(" list: list aliases (without argument, this list is "
"displayed)\n"
@@ -302,6 +317,7 @@ alias_command_init ()
"addcompletion: add an alias with a custom completion\n"
" del: delete an alias\n"
" rename: rename an alias\n"
+ " missing: add missing aliases (using default aliases)\n"
" completion: completion for alias: by default completion is "
"done with target command\n"
" note: you can use %%command to use completion of "
@@ -337,6 +353,7 @@ alias_command_init ()
" || add %(alias) %(commands:/)|%(alias_value)"
" || addcompletion %- %(alias) %(commands:/)|%(alias_value)"
" || del %(alias)|%*"
- " || rename %(alias) %(alias)",
+ " || rename %(alias) %(alias)"
+ " || missing",
&alias_command_cb, NULL, NULL);
}