summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/en/weechat_plugin_api.en.txt61
-rw-r--r--doc/fr/weechat_plugin_api.fr.txt63
-rw-r--r--doc/it/weechat_plugin_api.it.txt69
3 files changed, 162 insertions, 31 deletions
diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt
index 9b1251a03..e83cf2614 100644
--- a/doc/en/weechat_plugin_api.en.txt
+++ b/doc/en/weechat_plugin_api.en.txt
@@ -6991,10 +6991,26 @@ with an extra argument:
* 'options': options for command executed; the hashtable is duplicated in
function, so it's safe to free it after this call
-For a standard command (not beginning with "url:"), the hashtable 'options' can
-contain arguments for command (and then 'command' must be only the command
-without arguments) _(WeeChat ≥ 0.4.0)_. +
-The keys in hashtable must be: 'arg1', 'arg2', ...
+For a standard command (not beginning with "url:"), following options are
+available:
+
+[width="100%",cols="^1,1,3",options="header"]
+|===
+| Option | Value | Description
+
+| argN (N ≥ 1) +
+ _(WeeChat ≥ 0.4.0)_ |
+ any string |
+ Arguments for command; if no argument is given with these options,
+ the command is automatically split like the shell does (and then command
+ arguments are read in the 'command' argument)
+
+| stdin +
+ _(WeeChat ≥ 0.4.3)_ |
+ (not used) |
+ Create a pipe for writing data on standard input (stdin) of child process
+ (see function <<_weechat_hook_set,weechat_hook_set>>)
+|===
For command "url:...", following options are available (see
`man curl_easy_setopt` for a description of each option):
@@ -9426,7 +9442,7 @@ hook = weechat.hook_focus("buffer_nicklist", "my_focus_nicklist_cb", "")
==== weechat_hook_set
-_WeeChat ≥ 0.3.9._
+_WeeChat ≥ 0.3.9 (script: WeeChat ≥ 0.4.3)._
Set string value of a hook property.
@@ -9446,13 +9462,23 @@ Arguments:
Properties:
-[width="100%",cols="^2,4,8",options="header"]
+[width="100%",cols="^2,2,2,5",options="header"]
|===
-| Name | Value | Description
+| Name | Hook type | Value | Description
-| subplugin | any string |
+| subplugin | any type | any string |
Name of sub plugin (commonly script name, which is displayed in
`/help command` for a hook of type 'command')
+
+| stdin +
+ _(WeeChat ≥ 0.4.3)_ |
+ 'process', 'process_hashtable' | any string |
+ Send data on standard input ('stdin') of child process
+
+| stdin_close +
+ _(WeeChat ≥ 0.4.3)_ |
+ 'process', 'process_hashtable' | (not used) |
+ Close pipe used to send data on standard input ('stdin') of child process
|===
C example:
@@ -9466,8 +9492,23 @@ struct t_hook *my_command_hook =
weechat_hook_set (my_command_hook, "subplugin", "test");
----
-[NOTE]
-This function is not available in scripting API.
+Script (Python):
+
+[source,python]
+----
+# prototype
+weechat.hook_set(hook, property, value)
+
+# example
+def my_process_cb(data, command, return_code, out, err):
+ # ...
+ return weechat.WEECHAT_RC_OK
+
+hook = weechat.hook_process_hashtable("/path/to/command", { "stdin": "1" },
+ 20000, "my_process_cb", "")
+weechat.hook_set(hook, "stdin", "data sent to stdin of child process")
+weechat.hook_set(hook, "stdin_close", "") # optional
+----
==== weechat_unhook
diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt
index 410f6d2e2..f1c816875 100644
--- a/doc/fr/weechat_plugin_api.fr.txt
+++ b/doc/fr/weechat_plugin_api.fr.txt
@@ -7098,11 +7098,26 @@ supplémentaire :
* 'options' : options pour la commande exécutée; la hashtable est dupliquée dans
la fonction, donc il est possible de la supprimer après cet appel
-Pour une commande standard (ne commençant pas par "url:"), la hashtable
-'options' peut contenir les paramètres pour la commande (et donc 'command' doit
-être seulement la commande sans les paramètres)
-_(WeeChat ≥ 0.4.0)_. +
-Les clés dans la hashtable doivent être: 'arg1', 'arg2', ...
+Pour une commande standard (ne commençant pas par "url:"), les options suivantes
+sont disponibles :
+
+[width="100%",cols="^1,1,3",options="header"]
+|===
+| Option | Valeur | Description
+
+| argN (N ≥ 1) +
+ _(WeeChat ≥ 0.4.0)_ |
+ toute chaîne |
+ Paramètres pour la commande ; si aucun paramètre n'est donné avec ces options,
+ la commande sera automatiquement découpée comme le fait le shell (et donc les
+ paramètres de la commande sont lus dans le paramètre 'command')
+
+| stdin +
+ _(WeeChat ≥ 0.4.3)_ |
+ (non utilisée) |
+ Créer un tuyau pour écrire sur l'entrée standard (stdin) du processus fils
+ (voir la fonction <<_weechat_hook_set,weechat_hook_set>>)
+|===
Pour la commande "url:...", les options suivantes sont disponibles (voir
`man curl_easy_setopt` pour une description de chaque option) :
@@ -9592,7 +9607,7 @@ hook = weechat.hook_focus("buffer_nicklist", "my_focus_nicklist_cb", "")
==== weechat_hook_set
-_WeeChat ≥ 0.3.9._
+_WeeChat ≥ 0.3.9 (script: WeeChat ≥ 0.4.3)._
Affecte une valeur à une propriété d'un hook.
@@ -9612,13 +9627,24 @@ Paramètres :
Propriétés :
-[width="100%",cols="^2,4,8",options="header"]
+[width="100%",cols="^2,2,2,5",options="header"]
|===
-| Nom | Valeur | Description
+| Nom | Type de hook | Valeur | Description
-| subplugin | toute chaîne |
+| subplugin | tout type | toute chaîne |
Nom de la sous-extension (couramment un nom de script, qui est affiché dans
`/help commande` pour un hook de type 'command')
+
+| stdin +
+ _(WeeChat ≥ 0.4.3)_ |
+ 'process', 'process_hashtable' | toute chaîne |
+ Envoyer les données sur l'entrée standard ('stdin') du processus fils
+
+| stdin_close +
+ _(WeeChat ≥ 0.4.3)_ |
+ 'process', 'process_hashtable' | (non utilisée) |
+ Fermer le tuyau utilisé pour envoyer les données sur l'entrée standard
+ ('stdin') du processus fils
|===
Exemple en C :
@@ -9632,8 +9658,23 @@ struct t_hook *my_command_hook =
weechat_hook_set (my_command_hook, "subplugin", "test");
----
-[NOTE]
-Cette fonction n'est pas disponible dans l'API script.
+Script (Python) :
+
+[source,python]
+----
+# prototype
+weechat.hook_set(hook, property, value)
+
+# exemple
+def my_process_cb(data, command, return_code, out, err):
+ # ...
+ return weechat.WEECHAT_RC_OK
+
+hook = weechat.hook_process_hashtable("/chemin/vers/commande", { "stdin": "1" },
+ 20000, "my_process_cb", "")
+weechat.hook_set(hook, "stdin", "données envoyées sur le stdin du processus fils")
+weechat.hook_set(hook, "stdin_close", "") # facultatif
+----
==== weechat_unhook
diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt
index 2364339ab..ea810640b 100644
--- a/doc/it/weechat_plugin_api.it.txt
+++ b/doc/it/weechat_plugin_api.it.txt
@@ -7090,10 +7090,29 @@ Gli argomenti sono gli stessi della funzione
nella funzione, per cui è possibile liberarla dopo questa chiamata
// TRANSLATION MISSING
-For a standard command (not beginning with "url:"), the hashtable 'options' can
-contain arguments for command (and then 'command' must be only the command
-without arguments) _(WeeChat ≥ 0.4.0)_. +
-The keys in hashtable must be: 'arg1', 'arg2', ...
+For a standard command (not beginning with "url:"), following options are
+available:
+
+// TRANSLATION MISSING
+[width="100%",cols="^1,1,3",options="header"]
+|===
+| Option | Value | Description
+
+// TRANSLATION MISSING
+| argN (N ≥ 1) +
+ _(WeeChat ≥ 0.4.0)_ |
+ any string |
+ Arguments for command; if no argument is given with these options,
+ the command is automatically split like the shell does (and then command
+ arguments are read in the 'command' argument)
+
+// TRANSLATION MISSING
+| stdin +
+ _(WeeChat ≥ 0.4.3)_ |
+ (not used) |
+ Create a pipe for writing data on standard input (stdin) of child process
+ (see function <<_weechat_hook_set,weechat_hook_set>>)
+|===
Per il comando "url:..." sono disponibili le seguenti opzioni (consultare
`man curl_easy_setopt` per la descrizione di ogni opzione):
@@ -9624,7 +9643,7 @@ hook = weechat.hook_focus("buffer_nicklist", "my_focus_nicklist_cb", "")
==== weechat_hook_set
-_WeeChat ≥ 0.3.9._
+_WeeChat ≥ 0.3.9 (script: WeeChat ≥ 0.4.3)._
// TRANSLATION MISSING
Set string value of a hook property.
@@ -9648,14 +9667,29 @@ Argomenti:
// TRANSLATION MISSING
Properties:
-[width="100%",cols="^2,4,8",options="header"]
+// TRANSLATION MISSING
+[width="100%",cols="^2,2,2,5",options="header"]
|===
-| Nome | Valore | Descrizione
+| Nome | Hook type | Valore | Descrizione
-| subplugin | qualsiasi stringa |
+// TRANSLATION MISSING
+| subplugin | any type | qualsiasi stringa |
// TRANSLATION MISSING
Name of sub plugin (commonly script name, which is displayed in
`/help command` for a hook of type 'command')
+
+| stdin +
+ _(WeeChat ≥ 0.4.3)_ |
+ 'process', 'process_hashtable' | qualsiasi stringa |
+// TRANSLATION MISSING
+ Send data on standard input ('stdin') of child process
+
+| stdin_close +
+ _(WeeChat ≥ 0.4.3)_ |
+// TRANSLATION MISSING
+ 'process', 'process_hashtable' | (not used) |
+// TRANSLATION MISSING
+ Close pipe used to send data on standard input ('stdin') of child process
|===
Esempio in C:
@@ -9669,8 +9703,23 @@ struct t_hook *my_command_hook =
weechat_hook_set (my_command_hook, "subplugin", "test");
----
-[NOTE]
-Questa funzione non è disponibile nelle API per lo scripting.
+Script (Python):
+
+[source,python]
+----
+# prototipo
+weechat.hook_set(hook, property, value)
+
+# esempio
+def my_process_cb(data, command, return_code, out, err):
+ # ...
+ return weechat.WEECHAT_RC_OK
+
+hook = weechat.hook_process_hashtable("/path/to/command", { "stdin": "1" },
+ 20000, "my_process_cb", "")
+weechat.hook_set(hook, "stdin", "data sent to stdin of child process")
+weechat.hook_set(hook, "stdin_close", "") # optional
+----
==== weechat_unhook