From 2783b512015e0a42b528042a218d0e3a8843b7e5 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Fri, 8 May 2009 10:31:15 +0200 Subject: Improve completion: allow a command to use completion of another command (used by alias plugin) --- doc/en/dev/plugin_c_api.en.xml | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'doc/en/dev') diff --git a/doc/en/dev/plugin_c_api.en.xml b/doc/en/dev/plugin_c_api.en.xml index 211163bdf..538828c09 100644 --- a/doc/en/dev/plugin_c_api.en.xml +++ b/doc/en/dev/plugin_c_api.en.xml @@ -5034,6 +5034,7 @@ struct t_hook *weechat_hook_command ( : completion template for command: list of completions for each arguments, separated by space. Many completions are possible for one argument, separated by "|". + Many templates are possible for same command, separeted by "||". Default completion codes are: @@ -5059,6 +5060,10 @@ struct t_hook *weechat_hook_command ( + + %%command + Reuse completion template from /command + %- Stop completion @@ -5151,13 +5156,29 @@ my_command_cb (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; } +/* this is an example, inspired by weechat command /filter */ struct t_hook *my_command_hook = - weechat_hook_command ("mycommand", - "description of my command", - "[command [buffer]]", - "command: WeeChat or plugin command\n" - " buffer: buffer name", - "%w|%p %b", &my_command_cb, NULL); + weechat_hook_command (/* command name */ + "myfilter", + /* description */ + "description of myfilter", + /* args */ + "[list] | [enable|disable|toggle [name]] | " + "[add name plugin.buffer tags regex] | " + "[del name|-all]", + /* args description */ + "description of arguments...", + /* completion */ + "list" + " || enable %(filters_names)" + " || disable %(filters_names)" + " || toggle %(filters_names)" + " || add %(filters_names) %(buffers_plugins_names)|*" + " || del %(filters_names)|-all", + /* callback */ + &my_command_cb, + /* callback_data */ + NULL); -- cgit v1.2.3