1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 15:26:37 +02:00

exec: add options "-pipe" and "-hsignal" in command /exec

This commit is contained in:
Sebastien Helleu
2014-03-16 09:37:45 +01:00
parent 7afd013665
commit ffba715ea1
22 changed files with 402 additions and 146 deletions
+40 -38
View File
@@ -3,7 +3,7 @@
----
/exec -list
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] <command>
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
-in <id> <text>
-inclose <id> [<text>]
-signal <id> <signal>
@@ -12,45 +12,47 @@
-set <id> <property> <value>
-del <id>|-all [<id>...]
-list: zeigt laufende Befehle an
-sh: die shell wird verwendet um Befehle auszuführen (Standardverhalten)
-nosh: die shell wird nicht verwendet um Befehle auszuführen (wird benötigt, falls der Befehl mit sensiblen Daten hantiert. Zum Beispiel der Inhalt einer Nachricht eines anderen Users)
-bg: führt Prozess im Hintergrund aus: gibt weder eine Prozessausgabe noch einen Rückgabewert aus (nicht kompatibel mit Optionen -o/-n)
-nobg: gibt Prozessausgabe und Rückgabewert aus (Standardverhalten)
-stdin: erstellt eine PIPE um Daten zu dem Prozess zu senden (mittels /exec -in/-inclose)
-nostdin: es wird keine PIPE für stdin erstellt (Standardverhalten)
-buffer: zeigt/sendet Ausgabe des Befehls an diesen Buffer (wird der angegebene Buffer nicht gefunden wird ein neuer Bufger mit dem Namen "exec.exec.xxx" erstellt)
-l: gibt die Ausgabe des Befehls lokal im Buffer aus (Standardverhalten)
-o: gibt die Ausgabe des Befehls im Buffer aus (nicht kompatibel mit Option -bg)
-n: gibt die Ausgabe des Befehls in einem neuen Buffer aus (nicht kompatibel mit Option -bg)
-sw: es wird zum Ausgabebuffer gewechselt (Standardverhalten)
-nosw: es wird nicht zum Ausgabebuffer gewechselt
-ln: legt eine Zeilennummerierung an (Standardverhalten, nur für neue Buffer)
-noln: es wird keine Zeilennummerierung angezeigt
-color: es wird eine der folgenden Aktionen bei ANSI Zeichenkodierungen in der Ausgabe durchgeführt:
ansi: ANSI-Kodierung wird beibehalten
decode: konvertiert ANSI-Farben zu WeeChat/IRC Farben(Standardverhalten)
strip: ANSI-Farben werden entfernt
-rc: der Rückgabewert wird ausgegeben (Standardverhalten)
-norc: der Rückgabewert wird unterdrückt
-timeout: gibt eine Zeitbeschränkung für den auszuführenden Befehl an (in Sekunden)
-name: dem Befehl wird ein Name zugewiesen (um den Befehl später mittels /exec zu nutzen)
command: Befehl der ausgeführt werden soll; beginnt der Befehl mit "url:", wird die shell deaktiviert und der Inhalt der URL wird heruntergeladen und im Buffer ausgegeben
id: identifiziert eindeutig einen Befehl: entweder durch eine Nummer oder einen Namen (sofern ein Name mittels "-name xxx" zugewiesen wurde)
-in: sendet Text an die Standardeingabe des Prozesses
-inclose: wie -in aber stdin wird danach geschlossen (und der Text ist optional: ohne Text wird stdin umgehend geschlossen
-signal: schickt ein Signal an den Prozess; das Signal kann entweder ein Integerwert oder eines der folgenden Schlüsselworte sein: hup, int, quit, kill, term, usr1, usr2
-kill: Alias für "-signal <id> kill"
-killall: beendet alle laufenden Prozesse
-set: nutzt eine Hook-Fähigkeit (siehe Funktion hook_set in Anleitung für API Erweiterung)
property: Hook-Fähigkeit
value: neuer Wert für Hook-Fähigkeit
-del: entfernt einen beendeten Befehl
-all: entfernt alle beendeten Befehle
-list: list commands
-sh: use the shell to execute the command (default)
-nosh: do not use the shell to execute the command (required if the command has some unsafe data, for example the content of a message from another user)
-bg: run process in background: do not display process output neither return code (not compatible with options -o/-n)
-nobg: catch process output and display return code (default)
-stdin: create a pipe for sending data to the process (with /exec -in/-inclose)
-nostdin: do not create a pipe for stdin (default)
-buffer: display/send output of command on this buffer (if the buffer is not found, a new buffer with name "exec.exec.xxx" is created)
-l: display locally output of command on buffer (default)
-o: send output of command to the buffer (not compatible with option -bg)
-n: display output of command in a new buffer (not compatible with option -bg)
-sw: switch to the output buffer (default)
-nosw: don't switch to the output buffer
-ln: display line numbers (default in new buffer only)
-noln: don't display line numbers
-color: action on ANSI colors in output:
ansi: keep ANSI codes as-is
decode: convert ANSI colors to WeeChat/IRC (default)
strip: remove ANSI colors
-rc: display return code (default)
-norc: don't display return code
-timeout: set a timeout for the command (in seconds)
-name: set a name for the command (to name it later with /exec)
-pipe: send the output to a WeeChat/plugin command (line by line); if there are spaces in command/arguments, enclose them with double quotes; variable $line is replaced by the line (by default the line is added after the command, separated by a space) (not compatible with options -bg/-o/-n)
-hsignal: send the output as a hsignal (to be used for example in a trigger) (not compatible with options -bg/-o/-n)
command: the command to execute; if beginning with "url:", the shell is disabled and the content of URL is downloaded and sent as output
id: command identifier: either its number or name (if set with "-name xxx")
-in: send text on standard input of process
-inclose: same as -in, but stdin is closed after (and text is optional: without text, the stdin is just closed)
-signal: send a signal to the process; the signal can be an integer or one of these names: hup, int, quit, kill, term, usr1, usr2
-kill: alias of "-signal <id> kill"
-killall: kill all running processes
-set: set a hook property (see function hook_set in plugin API reference)
property: hook property
value: new value for hook property
-del: delete a terminated command
-all: delete all terminated commands
Standardoptionen können in der Option exec.command.default_options bestimmt werden.
Default options can be set in the option exec.command.default_options.
Beispiele:
Examples:
/exec -n ls -l /tmp
/exec -n ps xu | grep weechat
/exec -n -norc url:http://pastebin.com/raw.php?i=xxxxxxxx
+3 -1
View File
@@ -3,7 +3,7 @@
----
/exec -list
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] <command>
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
-in <id> <text>
-inclose <id> [<text>]
-signal <id> <signal>
@@ -35,6 +35,8 @@
-norc: don't display return code
-timeout: set a timeout for the command (in seconds)
-name: set a name for the command (to name it later with /exec)
-pipe: send the output to a WeeChat/plugin command (line by line); if there are spaces in command/arguments, enclose them with double quotes; variable $line is replaced by the line (by default the line is added after the command, separated by a space) (not compatible with options -bg/-o/-n)
-hsignal: send the output as a hsignal (to be used for example in a trigger) (not compatible with options -bg/-o/-n)
command: the command to execute; if beginning with "url:", the shell is disabled and the content of URL is downloaded and sent as output
id: command identifier: either its number or name (if set with "-name xxx")
-in: send text on standard input of process
+3 -1
View File
@@ -3,7 +3,7 @@
----
/exec -list
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <nom>] [-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout <délai>] [-name <nom>] <commande>
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <nom>] [-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout <délai>] [-name <nom>] [-pipe <commande>] [-hsignal <nom>] <commande>
-in <id> <texte>
-inclose <id> [<texte>]
-signal <id> <signal>
@@ -35,6 +35,8 @@
-norc: ne pas afficher le code retour
-timeout: définir un délai maximum pour la commande (en secondes)
-name: définir un nom pour la commande (pour la nommer plus tard avec /exec)
-pipe: envoyer la sortie vers une commande WeeChat/extension (ligne par ligne); s'il y a des espaces dans la commande/paramètres, entourez les de guillemets; la variable $line est remplacée par la ligne (par défaut la ligne est ajoutée après la commande, séparée par un espace) (non compatible avec les options -bg/-o/-n)
-hsignal: envoyer la sortie sous forme de hsignal (pour être utilisé par exemple dans un trigger) (non compatible avec les options -bg/-o/-n)
commande: la commande à exécuter; si elle commence par "url:", le shell est désactivé et le contenu de l'URL est téléchargé et envoyé comme sortie
id: identifiant de commande : soit le numéro ou le nom (si défini avec "-name xxx")
-in: envoyer le texte sur l'entrée standard du processus
+3 -1
View File
@@ -3,7 +3,7 @@
----
/exec -list
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] <command>
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
-in <id> <text>
-inclose <id> [<text>]
-signal <id> <signal>
@@ -35,6 +35,8 @@
-norc: don't display return code
-timeout: set a timeout for the command (in seconds)
-name: set a name for the command (to name it later with /exec)
-pipe: send the output to a WeeChat/plugin command (line by line); if there are spaces in command/arguments, enclose them with double quotes; variable $line is replaced by the line (by default the line is added after the command, separated by a space) (not compatible with options -bg/-o/-n)
-hsignal: send the output as a hsignal (to be used for example in a trigger) (not compatible with options -bg/-o/-n)
command: the command to execute; if beginning with "url:", the shell is disabled and the content of URL is downloaded and sent as output
id: command identifier: either its number or name (if set with "-name xxx")
-in: send text on standard input of process
+3 -1
View File
@@ -3,7 +3,7 @@
----
/exec -list
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] <command>
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
-in <id> <text>
-inclose <id> [<text>]
-signal <id> <signal>
@@ -35,6 +35,8 @@
-norc: don't display return code
-timeout: set a timeout for the command (in seconds)
-name: set a name for the command (to name it later with /exec)
-pipe: send the output to a WeeChat/plugin command (line by line); if there are spaces in command/arguments, enclose them with double quotes; variable $line is replaced by the line (by default the line is added after the command, separated by a space) (not compatible with options -bg/-o/-n)
-hsignal: send the output as a hsignal (to be used for example in a trigger) (not compatible with options -bg/-o/-n)
command: the command to execute; if beginning with "url:", the shell is disabled and the content of URL is downloaded and sent as output
id: command identifier: either its number or name (if set with "-name xxx")
-in: send text on standard input of process
+3 -1
View File
@@ -3,7 +3,7 @@
----
/exec -list
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] <command>
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
-in <id> <text>
-inclose <id> [<text>]
-signal <id> <signal>
@@ -35,6 +35,8 @@
-norc: don't display return code
-timeout: set a timeout for the command (in seconds)
-name: set a name for the command (to name it later with /exec)
-pipe: send the output to a WeeChat/plugin command (line by line); if there are spaces in command/arguments, enclose them with double quotes; variable $line is replaced by the line (by default the line is added after the command, separated by a space) (not compatible with options -bg/-o/-n)
-hsignal: send the output as a hsignal (to be used for example in a trigger) (not compatible with options -bg/-o/-n)
command: the command to execute; if beginning with "url:", the shell is disabled and the content of URL is downloaded and sent as output
id: command identifier: either its number or name (if set with "-name xxx")
-in: send text on standard input of process
+10 -4
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-03-15 19:36+0100\n"
"POT-Creation-Date: 2014-03-16 09:34+0100\n"
"PO-Revision-Date: 2014-03-10 21:06+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4623,9 +4623,9 @@ msgstr "vykonat příkaz v tichosti"
msgid ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<timeout>] [-name <name>] <command> || -in <id> <text> || -inclose <id> "
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
"<timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command> || -"
"in <id> <text> || -inclose <id> [<text>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <property> <value> || -del <id>|-all [<id>...]"
msgstr ""
msgid ""
@@ -4659,6 +4659,12 @@ msgid ""
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by line); if "
"there are spaces in command/arguments, enclose them with double quotes; "
"variable $line is replaced by the line (by default the line is added after "
"the command, separated by a space) (not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in a trigger) "
"(not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the shell is "
"disabled and the content of URL is downloaded and sent as output\n"
" id: command identifier: either its number or name (if set with \"-name "
+12 -4
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-03-15 19:36+0100\n"
"POT-Creation-Date: 2014-03-16 09:34+0100\n"
"PO-Revision-Date: 2014-03-15 19:39+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@@ -5325,12 +5325,13 @@ msgstr "Befehl \"%s\" entfernt"
msgid "execute external commands"
msgstr "führe externe Befehle aus"
#, fuzzy
msgid ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<timeout>] [-name <name>] <command> || -in <id> <text> || -inclose <id> "
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
"<timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command> || -"
"in <id> <text> || -inclose <id> [<text>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <property> <value> || -del <id>|-all [<id>...]"
msgstr ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
@@ -5338,6 +5339,7 @@ msgstr ""
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
#, fuzzy
msgid ""
" -list: list commands\n"
" -sh: use the shell to execute the command (default)\n"
@@ -5369,6 +5371,12 @@ msgid ""
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by line); if "
"there are spaces in command/arguments, enclose them with double quotes; "
"variable $line is replaced by the line (by default the line is added after "
"the command, separated by a space) (not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in a trigger) "
"(not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the shell is "
"disabled and the content of URL is downloaded and sent as output\n"
" id: command identifier: either its number or name (if set with \"-name "
+10 -4
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-03-15 19:36+0100\n"
"POT-Creation-Date: 2014-03-16 09:34+0100\n"
"PO-Revision-Date: 2014-03-10 21:07+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4838,9 +4838,9 @@ msgstr "ejecuta un comando silenciosamente"
msgid ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<timeout>] [-name <name>] <command> || -in <id> <text> || -inclose <id> "
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
"<timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command> || -"
"in <id> <text> || -inclose <id> [<text>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <property> <value> || -del <id>|-all [<id>...]"
msgstr ""
msgid ""
@@ -4874,6 +4874,12 @@ msgid ""
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by line); if "
"there are spaces in command/arguments, enclose them with double quotes; "
"variable $line is replaced by the line (by default the line is added after "
"the command, separated by a space) (not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in a trigger) "
"(not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the shell is "
"disabled and the content of URL is downloaded and sent as output\n"
" id: command identifier: either its number or name (if set with \"-name "
+22 -8
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-03-15 19:36+0100\n"
"PO-Revision-Date: 2014-03-15 19:37+0100\n"
"POT-Creation-Date: 2014-03-16 09:34+0100\n"
"PO-Revision-Date: 2014-03-16 09:35+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -5198,15 +5198,16 @@ msgstr "exécuter des commandes externes"
msgid ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<timeout>] [-name <name>] <command> || -in <id> <text> || -inclose <id> "
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
"<timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command> || -"
"in <id> <text> || -inclose <id> [<text>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <property> <value> || -del <id>|-all [<id>...]"
msgstr ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <nom>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<délai>] [-name <nom>] <commande> || -in <id> <texte> || -inclose <id> "
"[<texte>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<propriété> <valeur> || -del <id>|-all [<id>...]"
"<délai>] [-name <nom>] [-pipe <commande>] [-hsignal <nom>] <commande> || -in "
"<id> <texte> || -inclose <id> [<texte>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <propriété> <valeur> || -del <id>|-all "
"[<id>...]"
msgid ""
" -list: list commands\n"
@@ -5239,6 +5240,12 @@ msgid ""
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by line); if "
"there are spaces in command/arguments, enclose them with double quotes; "
"variable $line is replaced by the line (by default the line is added after "
"the command, separated by a space) (not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in a trigger) "
"(not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the shell is "
"disabled and the content of URL is downloaded and sent as output\n"
" id: command identifier: either its number or name (if set with \"-name "
@@ -5301,6 +5308,13 @@ msgstr ""
" -timeout: définir un délai maximum pour la commande (en secondes)\n"
" -name: définir un nom pour la commande (pour la nommer plus tard avec /"
"exec)\n"
" -pipe: envoyer la sortie vers une commande WeeChat/extension (ligne par "
"ligne); s'il y a des espaces dans la commande/paramètres, entourez les de "
"guillemets; la variable $line est remplacée par la ligne (par défaut la "
"ligne est ajoutée après la commande, séparée par un espace) (non compatible "
"avec les options -bg/-o/-n)\n"
" -hsignal: envoyer la sortie sous forme de hsignal (pour être utilisé par "
"exemple dans un trigger) (non compatible avec les options -bg/-o/-n)\n"
" commande: la commande à exécuter; si elle commence par \"url:\", le shell "
"est désactivé et le contenu de l'URL est téléchargé et envoyé comme sortie\n"
" id: identifiant de commande : soit le numéro ou le nom (si défini "
+10 -4
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-03-15 19:36+0100\n"
"POT-Creation-Date: 2014-03-16 09:34+0100\n"
"PO-Revision-Date: 2014-03-10 21:07+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4212,9 +4212,9 @@ msgstr "%s belső parancsok:\n"
msgid ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<timeout>] [-name <name>] <command> || -in <id> <text> || -inclose <id> "
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
"<timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command> || -"
"in <id> <text> || -inclose <id> [<text>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <property> <value> || -del <id>|-all [<id>...]"
msgstr ""
msgid ""
@@ -4248,6 +4248,12 @@ msgid ""
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by line); if "
"there are spaces in command/arguments, enclose them with double quotes; "
"variable $line is replaced by the line (by default the line is added after "
"the command, separated by a space) (not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in a trigger) "
"(not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the shell is "
"disabled and the content of URL is downloaded and sent as output\n"
" id: command identifier: either its number or name (if set with \"-name "
+10 -4
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-03-15 19:36+0100\n"
"POT-Creation-Date: 2014-03-16 09:34+0100\n"
"PO-Revision-Date: 2014-03-10 21:07+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4976,9 +4976,9 @@ msgstr "esegue un comando in silenzio"
msgid ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<timeout>] [-name <name>] <command> || -in <id> <text> || -inclose <id> "
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
"<timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command> || -"
"in <id> <text> || -inclose <id> [<text>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <property> <value> || -del <id>|-all [<id>...]"
msgstr ""
msgid ""
@@ -5012,6 +5012,12 @@ msgid ""
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by line); if "
"there are spaces in command/arguments, enclose them with double quotes; "
"variable $line is replaced by the line (by default the line is added after "
"the command, separated by a space) (not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in a trigger) "
"(not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the shell is "
"disabled and the content of URL is downloaded and sent as output\n"
" id: command identifier: either its number or name (if set with \"-name "
+10 -4
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-03-15 19:36+0100\n"
"POT-Creation-Date: 2014-03-16 09:34+0100\n"
"PO-Revision-Date: 2014-03-10 21:07+0100\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@@ -4983,9 +4983,9 @@ msgstr "静かにコマンドを実行"
msgid ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<timeout>] [-name <name>] <command> || -in <id> <text> || -inclose <id> "
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
"<timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command> || -"
"in <id> <text> || -inclose <id> [<text>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <property> <value> || -del <id>|-all [<id>...]"
msgstr ""
msgid ""
@@ -5019,6 +5019,12 @@ msgid ""
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by line); if "
"there are spaces in command/arguments, enclose them with double quotes; "
"variable $line is replaced by the line (by default the line is added after "
"the command, separated by a space) (not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in a trigger) "
"(not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the shell is "
"disabled and the content of URL is downloaded and sent as output\n"
" id: command identifier: either its number or name (if set with \"-name "
+10 -4
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-03-15 19:36+0100\n"
"POT-Creation-Date: 2014-03-16 09:34+0100\n"
"PO-Revision-Date: 2014-03-10 21:07+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5095,9 +5095,9 @@ msgstr "wykonuje komendę po cichu"
msgid ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<timeout>] [-name <name>] <command> || -in <id> <text> || -inclose <id> "
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
"<timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command> || -"
"in <id> <text> || -inclose <id> [<text>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <property> <value> || -del <id>|-all [<id>...]"
msgstr ""
msgid ""
@@ -5131,6 +5131,12 @@ msgid ""
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by line); if "
"there are spaces in command/arguments, enclose them with double quotes; "
"variable $line is replaced by the line (by default the line is added after "
"the command, separated by a space) (not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in a trigger) "
"(not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the shell is "
"disabled and the content of URL is downloaded and sent as output\n"
" id: command identifier: either its number or name (if set with \"-name "
+10 -4
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-03-15 19:36+0100\n"
"POT-Creation-Date: 2014-03-16 09:34+0100\n"
"PO-Revision-Date: 2014-03-10 21:07+0100\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4679,9 +4679,9 @@ msgstr "executa um comando silenciosamente"
msgid ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<timeout>] [-name <name>] <command> || -in <id> <text> || -inclose <id> "
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
"<timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command> || -"
"in <id> <text> || -inclose <id> [<text>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <property> <value> || -del <id>|-all [<id>...]"
msgstr ""
msgid ""
@@ -4715,6 +4715,12 @@ msgid ""
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by line); if "
"there are spaces in command/arguments, enclose them with double quotes; "
"variable $line is replaced by the line (by default the line is added after "
"the command, separated by a space) (not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in a trigger) "
"(not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the shell is "
"disabled and the content of URL is downloaded and sent as output\n"
" id: command identifier: either its number or name (if set with \"-name "
+10 -4
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-03-15 19:36+0100\n"
"POT-Creation-Date: 2014-03-16 09:34+0100\n"
"PO-Revision-Date: 2014-03-10 21:07+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4245,9 +4245,9 @@ msgstr "Внутренние команды %s:\n"
msgid ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<timeout>] [-name <name>] <command> || -in <id> <text> || -inclose <id> "
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
"<timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command> || -"
"in <id> <text> || -inclose <id> [<text>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <property> <value> || -del <id>|-all [<id>...]"
msgstr ""
msgid ""
@@ -4281,6 +4281,12 @@ msgid ""
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by line); if "
"there are spaces in command/arguments, enclose them with double quotes; "
"variable $line is replaced by the line (by default the line is added after "
"the command, separated by a space) (not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in a trigger) "
"(not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the shell is "
"disabled and the content of URL is downloaded and sent as output\n"
" id: command identifier: either its number or name (if set with \"-name "
+10 -4
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-03-15 19:36+0100\n"
"POT-Creation-Date: 2014-03-16 09:34+0100\n"
"PO-Revision-Date: 2014-03-10 21:07+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3801,9 +3801,9 @@ msgstr "weechat komutları"
msgid ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<timeout>] [-name <name>] <command> || -in <id> <text> || -inclose <id> "
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
"<timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command> || -"
"in <id> <text> || -inclose <id> [<text>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <property> <value> || -del <id>|-all [<id>...]"
msgstr ""
msgid ""
@@ -3837,6 +3837,12 @@ msgid ""
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by line); if "
"there are spaces in command/arguments, enclose them with double quotes; "
"variable $line is replaced by the line (by default the line is added after "
"the command, separated by a space) (not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in a trigger) "
"(not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the shell is "
"disabled and the content of URL is downloaded and sent as output\n"
" id: command identifier: either its number or name (if set with \"-name "
+10 -4
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-03-15 19:36+0100\n"
"POT-Creation-Date: 2014-03-16 09:34+0100\n"
"PO-Revision-Date: 2013-02-14 18:20+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3801,9 +3801,9 @@ msgstr ""
msgid ""
"-list || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-"
"n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] [-rc|-norc] [-timeout "
"<timeout>] [-name <name>] <command> || -in <id> <text> || -inclose <id> "
"[<text>] || -signal <id> <signal> || -kill <id> || -killall || -set <id> "
"<property> <value> || -del <id>|-all [<id>...]"
"<timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command> || -"
"in <id> <text> || -inclose <id> [<text>] || -signal <id> <signal> || -kill "
"<id> || -killall || -set <id> <property> <value> || -del <id>|-all [<id>...]"
msgstr ""
msgid ""
@@ -3837,6 +3837,12 @@ msgid ""
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by line); if "
"there are spaces in command/arguments, enclose them with double quotes; "
"variable $line is replaced by the line (by default the line is added after "
"the command, separated by a space) (not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in a trigger) "
"(not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the shell is "
"disabled and the content of URL is downloaded and sent as output\n"
" id: command identifier: either its number or name (if set with \"-name "
+80 -4
View File
@@ -179,7 +179,7 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options,
int argc, char **argv, int start_arg,
int set_command_index)
{
int i;
int i, j, end, length, length_total;
char *error;
for (i = start_arg; i < argc; i++)
@@ -289,6 +289,62 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options,
i++;
cmd_options->ptr_command_name = argv[i];
}
else if (weechat_strcasecmp (argv[i], "-pipe") == 0)
{
if (i + 1 >= argc)
return 0;
i++;
if (cmd_options->pipe_command)
{
free (cmd_options->pipe_command);
cmd_options->pipe_command = NULL;
}
if (argv[i][0] == '"')
{
/* search the ending double quote */
length_total = 1;
end = i;
while (end < argc)
{
length = strlen (argv[end]);
length_total += length + 1;
if ((length > 0) && (argv[end][length - 1] == '"'))
break;
end++;
}
if (end == argc)
return 0;
cmd_options->pipe_command = malloc (length_total);
if (!cmd_options->pipe_command)
return 0;
cmd_options->pipe_command[0] = '\0';
for (j = i; j <= end; j++)
{
if (cmd_options->pipe_command[0])
strcat (cmd_options->pipe_command, " ");
strcat (cmd_options->pipe_command,
(j == i) ? argv[j] + 1 : argv[j]);
}
length = strlen (cmd_options->pipe_command);
if (length > 0)
cmd_options->pipe_command[length - 1] = '\0';
i = end;
}
else
cmd_options->pipe_command = strdup (argv[i]);
}
else if (weechat_strcasecmp (argv[i], "-hsignal") == 0)
{
if (i + 1 >= argc)
return 0;
i++;
if (cmd_options->hsignal)
{
free (cmd_options->hsignal);
cmd_options->hsignal = NULL;
}
cmd_options->hsignal = strdup (argv[i]);
}
else
{
if (set_command_index)
@@ -338,6 +394,8 @@ exec_command_run (struct t_gui_buffer *buffer,
cmd_options.color = EXEC_COLOR_DECODE;
cmd_options.display_rc = 1;
cmd_options.ptr_command_name = NULL;
cmd_options.pipe_command = NULL;
cmd_options.hsignal = NULL;
/* parse default options */
if (!exec_command_parse_options (&cmd_options,
@@ -359,6 +417,12 @@ exec_command_run (struct t_gui_buffer *buffer,
&& (cmd_options.output_to_buffer || cmd_options.new_buffer))
return WEECHAT_RC_ERROR;
/* options "-pipe" and "-bg"/"-o"/"-n" are incompatible */
if (cmd_options.pipe_command
&& (cmd_options.detached || cmd_options.output_to_buffer
|| cmd_options.new_buffer))
return WEECHAT_RC_ERROR;
/* command not found? */
if (cmd_options.command_index < 0)
return WEECHAT_RC_ERROR;
@@ -398,7 +462,9 @@ exec_command_run (struct t_gui_buffer *buffer,
strdup (cmd_options.ptr_command_name) : NULL;
new_exec_cmd->command = strdup (argv_eol[cmd_options.command_index]);
new_exec_cmd->detached = cmd_options.detached;
if (!cmd_options.detached)
if (!cmd_options.detached && !cmd_options.pipe_command
&& !cmd_options.hsignal)
{
if (cmd_options.ptr_buffer_name && !cmd_options.ptr_buffer)
{
@@ -454,6 +520,8 @@ exec_command_run (struct t_gui_buffer *buffer,
cmd_options.new_buffer : cmd_options.line_numbers;
new_exec_cmd->color = cmd_options.color;
new_exec_cmd->display_rc = cmd_options.display_rc;
new_exec_cmd->pipe_command = cmd_options.pipe_command;
new_exec_cmd->hsignal = cmd_options.hsignal;
/* execute the command */
if (weechat_exec_plugin->debug >= 1)
@@ -685,7 +753,8 @@ exec_command_init ()
N_("-list"
" || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] "
"[-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-color off|decode|strip] "
"[-rc|-norc] [-timeout <timeout>] [-name <name>] <command>"
"[-rc|-norc] [-timeout <timeout>] [-name <name>] "
"[-pipe <command>] [-hsignal <name>] <command>"
" || -in <id> <text>"
" || -inclose <id> [<text>]"
" || -signal <id> <signal>"
@@ -724,6 +793,13 @@ exec_command_init ()
" -norc: don't display return code\n"
"-timeout: set a timeout for the command (in seconds)\n"
" -name: set a name for the command (to name it later with /exec)\n"
" -pipe: send the output to a WeeChat/plugin command (line by "
"line); if there are spaces in command/arguments, enclose them with "
"double quotes; variable $line is replaced by the line (by default "
"the line is added after the command, separated by a space) "
"(not compatible with options -bg/-o/-n)\n"
"-hsignal: send the output as a hsignal (to be used for example in "
"a trigger) (not compatible with options -bg/-o/-n)\n"
" command: the command to execute; if beginning with \"url:\", the "
"shell is disabled and the content of URL is downloaded and sent as "
"output\n"
@@ -753,7 +829,7 @@ exec_command_init ()
" /exec -o uptime"),
"-list"
" || -sh|-nosh|-bg|-nobg|-stdin|-nostdin|-buffer|-l|-o|-n|-sw|-nosw|"
"-ln|-noln|-color|-timeout|-name|%*"
"-ln|-noln|-color|-timeout|-name|-pipe|-hsignal|%*"
" || -in|-inclose|-signal|-kill %(exec_commands_ids)"
" || -killall"
" || -set %(exec_commands_ids) stdin|stdin_close|signal"
+2
View File
@@ -36,6 +36,8 @@ struct t_exec_cmd_options
int color; /* what to do with ANSI colors */
int display_rc; /* 1 to display return code */
const char *ptr_command_name; /* name of command */
char *pipe_command; /* output piped to WeeChat/plugin cmd*/
char *hsignal; /* send a hsignal with output */
};
extern int exec_command_run (struct t_gui_buffer *buffer,
+127 -47
View File
@@ -158,6 +158,8 @@ exec_add ()
new_exec_cmd->err_size = 0;
new_exec_cmd->err = NULL;
new_exec_cmd->return_code = -1;
new_exec_cmd->pipe_command = NULL;
new_exec_cmd->hsignal = NULL;
exec_cmds_count++;
@@ -198,7 +200,7 @@ exec_timer_delete_cb (void *data, int remaining_calls)
*/
void
exec_command_concat_output (int *size, char **output, const char *text)
exec_concat_output (int *size, char **output, const char *text)
{
int length, new_size;
char *new_output;
@@ -214,13 +216,35 @@ exec_command_concat_output (int *size, char **output, const char *text)
*size = new_size;
}
/*
* Decodes colors in a string (from stdout/stderr).
*
* Returns string with colors as-is, decoded or removed.
*/
char *
exec_decode_color (struct t_exec_cmd *exec_cmd, const char *string)
{
if (!string)
return NULL;
if (exec_cmd->color == EXEC_COLOR_ANSI)
return strdup (string);
return weechat_hook_modifier_exec (
(exec_cmd->output_to_buffer || exec_cmd->pipe_command) ?
"irc_color_decode_ansi" : "color_decode_ansi",
(exec_cmd->color == EXEC_COLOR_DECODE) ? "1" : "0",
string);
}
/*
* Displays output of a command.
*/
void
exec_command_display_output (struct t_exec_cmd *exec_cmd,
struct t_gui_buffer *buffer, int out)
exec_display_output (struct t_exec_cmd *exec_cmd,
struct t_gui_buffer *buffer, int out)
{
char *ptr_output, *ptr_line, *line, *line2, *pos;
char str_number[32], str_tags[1024];
@@ -234,7 +258,7 @@ exec_command_display_output (struct t_exec_cmd *exec_cmd,
* if output is sent to the buffer, the buffer must exist
* (we don't send output by default to core buffer)
*/
if (exec_cmd->output_to_buffer && !buffer)
if (exec_cmd->output_to_buffer && !exec_cmd->pipe_command && !buffer)
return;
ptr_line = ptr_output;
@@ -252,20 +276,40 @@ exec_command_display_output (struct t_exec_cmd *exec_cmd,
if (!line)
break;
if (exec_cmd->color != EXEC_COLOR_ANSI)
{
line2 = weechat_hook_modifier_exec (
(exec_cmd->output_to_buffer) ?
"irc_color_decode_ansi" : "color_decode_ansi",
(exec_cmd->color == EXEC_COLOR_DECODE) ? "1" : "0",
line);
free (line);
if (!line2)
break;
line = line2;
}
/* decode colors */
line2 = exec_decode_color (exec_cmd, line);
free (line);
if (!line2)
break;
line = line2;
if (exec_cmd->output_to_buffer)
if (exec_cmd->pipe_command)
{
if (strstr (exec_cmd->pipe_command, "$line"))
{
/* replace $line by line content */
line2 = weechat_string_replace (exec_cmd->pipe_command,
"$line", line);
if (line2)
{
weechat_command (buffer, line2);
free (line2);
}
}
else
{
/* add line at the end of command, after a space */
length = strlen (exec_cmd->pipe_command) + 1 + strlen (line) + 1;
line2 = malloc (length);
if (line2)
{
snprintf (line2, length, "%s %s", exec_cmd->pipe_command, line);
weechat_command (buffer, line2);
free (line2);
}
}
}
else if (exec_cmd->output_to_buffer)
{
if (exec_cmd->line_numbers)
{
@@ -310,35 +354,65 @@ void
exec_end_command (struct t_exec_cmd *exec_cmd, int return_code)
{
struct t_gui_buffer *ptr_buffer;
struct t_hashtable *hashtable;
char str_number[32], *output;
ptr_buffer = weechat_buffer_search ("==", exec_cmd->buffer_full_name);
/* display stdout/stderr (if output to buffer, the buffer must exist) */
exec_command_display_output (exec_cmd, ptr_buffer, 1);
exec_command_display_output (exec_cmd, ptr_buffer, 0);
/*
* display return code (only if command is not detached and if output is
* NOT sent to buffer)
*/
if (!exec_cmd->detached && !exec_cmd->output_to_buffer
&& exec_cmd->display_rc)
if (exec_cmd->hsignal)
{
if (return_code >= 0)
hashtable = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (hashtable)
{
weechat_printf_tags (ptr_buffer, "exec_rc",
_("%s: end of command %d (\"%s\"), "
"return code: %d"),
EXEC_PLUGIN_NAME, exec_cmd->number,
exec_cmd->command, return_code);
weechat_hashtable_set (hashtable, "command", exec_cmd->command);
snprintf (str_number, sizeof (str_number), "%d", exec_cmd->number);
weechat_hashtable_set (hashtable, "number", str_number);
weechat_hashtable_set (hashtable, "name", exec_cmd->name);
output = exec_decode_color (exec_cmd, exec_cmd->out);
weechat_hashtable_set (hashtable, "out", output);
if (output)
free (output);
output = exec_decode_color (exec_cmd, exec_cmd->err);
weechat_hashtable_set (hashtable, "err", output);
if (output)
free (output);
weechat_hook_hsignal_send (exec_cmd->hsignal, hashtable);
weechat_hashtable_free (hashtable);
}
else
}
else
{
ptr_buffer = weechat_buffer_search ("==", exec_cmd->buffer_full_name);
exec_display_output (exec_cmd, ptr_buffer, 1);
exec_display_output (exec_cmd, ptr_buffer, 0);
/*
* display return code (only if command is not detached, if output is
* NOT sent to buffer, and if command is not piped)
*/
if (exec_cmd->display_rc
&& !exec_cmd->detached && !exec_cmd->output_to_buffer
&& !exec_cmd->pipe_command)
{
weechat_printf_tags (ptr_buffer, "exec_rc",
_("%s: unexpected end of command %d "
"(\"%s\")"),
EXEC_PLUGIN_NAME, exec_cmd->number,
exec_cmd->command);
if (return_code >= 0)
{
weechat_printf_tags (ptr_buffer, "exec_rc",
_("%s: end of command %d (\"%s\"), "
"return code: %d"),
EXEC_PLUGIN_NAME, exec_cmd->number,
exec_cmd->command, return_code);
}
else
{
weechat_printf_tags (ptr_buffer, "exec_rc",
_("%s: unexpected end of command %d "
"(\"%s\")"),
EXEC_PLUGIN_NAME, exec_cmd->number,
exec_cmd->command);
}
}
}
@@ -394,15 +468,15 @@ exec_process_cb (void *data, const char *command, int return_code,
if (out)
{
exec_command_concat_output (&ptr_exec_cmd->out_size,
&ptr_exec_cmd->out,
out);
exec_concat_output (&ptr_exec_cmd->out_size,
&ptr_exec_cmd->out,
out);
}
if (err)
{
exec_command_concat_output (&ptr_exec_cmd->err_size,
&ptr_exec_cmd->err,
err);
exec_concat_output (&ptr_exec_cmd->err_size,
&ptr_exec_cmd->err,
err);
}
if (return_code >= 0)
@@ -444,6 +518,10 @@ exec_free (struct t_exec_cmd *exec_cmd)
free (exec_cmd->out);
if (exec_cmd->err)
free (exec_cmd->err);
if (exec_cmd->pipe_command)
free (exec_cmd->pipe_command);
if (exec_cmd->hsignal)
free (exec_cmd->hsignal);
free (exec_cmd);
@@ -494,6 +572,8 @@ exec_print_log ()
weechat_log_printf (" err_size. . . . . . . . : %d", ptr_exec_cmd->err_size);
weechat_log_printf (" err . . . . . . . . . . : '%s'", ptr_exec_cmd->err);
weechat_log_printf (" return_code . . . . . . : %d", ptr_exec_cmd->return_code);
weechat_log_printf (" pipe_command. . . . . . : '%s'", ptr_exec_cmd->pipe_command);
weechat_log_printf (" hsignal . . . . . . . . : '%s'", ptr_exec_cmd->hsignal);
weechat_log_printf (" prev_cmd. . . . . . . . : 0x%lx", ptr_exec_cmd->prev_cmd);
weechat_log_printf (" next_cmd. . . . . . . . : 0x%lx", ptr_exec_cmd->next_cmd);
}
+4
View File
@@ -60,6 +60,10 @@ struct t_exec_cmd
char *err; /* stderr of command */
int return_code; /* command return code */
/* pipe/hsignal */
char *pipe_command; /* output piped to WeeChat/plugin cmd*/
char *hsignal; /* send a hsignal with output */
struct t_exec_cmd *prev_cmd; /* link to previous command */
struct t_exec_cmd *next_cmd; /* link to next command */
};