diff options
Diffstat (limited to 'doc/en')
-rw-r--r-- | doc/en/weechat_plugin_api.en.txt | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index d9f657df4..1f19900d5 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -7342,6 +7342,64 @@ hook = weechat.hook_completion("plugin_item", "my custom completion!", "my_completion_cb", "") ---------------------------------------- +weechat_hook_completion_get_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Get a completion property as string. + +Prototype: + +[source,C] +---------------------------------------- +const char *weechat_hook_completion_get_string (struct t_gui_completion *completion, + const char *property); +---------------------------------------- + +Arguments: + +* 'completion': completion pointer +* 'property': property name: +** 'base_command': command used for completion +** 'base_word': word being completed +** 'args': command arguments (including base word) + +C example: + +[source,C] +---------------------------------------- +int +my_completion_cb (void *data, const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + /* get arguments of command */ + const char *args = weechat_hook_completion_get_string (completion, "args"); + + /* completion depending on args */ + /* ... */ + + return WEECHAT_RC_OK; +} +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.hook_completion_get_string(completion, property) + +# example +def my_completion_cb(data, completion_item, buffer, completion): + # get arguments of command + args = weechat.hook_completion_get_string(completion, "args") + # completion depending on args + # ... + return weechat.WEECHAT_RC_OK +---------------------------------------- + weechat_hook_completion_list_add ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |