1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-10 19:53:13 +02:00

exec: display output of commands in real time, add options -flush/-noflush in command /exec

This commit is contained in:
Sébastien Helleu
2014-04-03 11:55:04 +02:00
parent 936d5559f4
commit 7c55cbb38b
22 changed files with 391 additions and 285 deletions
+47 -45
View File
@@ -3,7 +3,7 @@
----
/exec -list
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] [-flush|-noflush] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
-in <id> <text>
-inclose <id> [<text>]
-signal <id> <signal>
@@ -12,52 +12,54 @@
-set <id> <property> <value>
-del <id>|-all [<id>...]
-list: zeigt laufende Befehle an
-sh: es wird die shell um Befehle auszuführen (WARNUNG: Diese Option sollte nur verwendet werden, falls alle Argumente unbedenklich sind, siehe Option -nosh)
-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)
-nf: gibt die Ausgabe des Befehls in einem neuen Buffer, mit einem freien Inhalt (kein Zeilenumbruch, keine Limitierung in der Anzahl der Zeilen), aus (nicht kompatibel mit Option -bg)
-cl: der neue Buffer wird vor einer Ausgabe gelöscht
-nocl: Ausgabe wird an neuen Buffer angehangen, ohne diesen vorher zu löschen (Standardverhalten)
-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
auto: konvertiert ANSI-Farben nach WeeChat/IRC (Standardverhalten)
irc: konvertiert ANSI-Farben nach IRC Farben
weechat: konvertiert ANSI-Farben nach WeeChat-Farben
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)
-pipe: sendet die Ausgabe an einen Befehl von WeeChat/Erweiterung (Zeile für Zeile); sollen Leerzeichen im Befehl/Argument verwendet werden, müssen diese mit Anführungszeichen eingeschlossen werden; Variable $line wird durch die entsprechende Zeile ersetzt (standardmäßig wird die Zeile, getrennt durch ein Leerzeichen, dem Befehl nachgestellt (nicht kompatibel mit den Optionen -bg/-o/-n)
-hsignal: sendet die Ausgabe als hsignal (um es z.B. mittels /trigger zu verwenden) (nicht kompatibel mit den Optionen -bg/-o/-n)
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 (WARNING: use this option ONLY if all arguments are safe, see option -nosh)
-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) (default)
-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)
-nf: display output of command in a new buffer with free content (no word-wrap, no limit on number of lines) (not compatible with option -bg)
-cl: clear the new buffer before displaying output
-nocl: append to the new buffer without clear (default)
-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
-flush: display output of command in real time (default)
-noflush: display output of command after its end
-color: action on ANSI colors in output:
ansi: keep ANSI codes as-is
auto: convert ANSI colors to WeeChat/IRC (default)
irc: convert ANSI colors to IRC colors
weechat: convert ANSI colors to WeeChat colors
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|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] [-flush|-noflush] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
-in <id> <text>
-inclose <id> [<text>]
-signal <id> <signal>
@@ -30,6 +30,8 @@
-nosw: don't switch to the output buffer
-ln: display line numbers (default in new buffer only)
-noln: don't display line numbers
-flush: display output of command in real time (default)
-noflush: display output of command after its end
-color: action on ANSI colors in output:
ansi: keep ANSI codes as-is
auto: convert ANSI colors to WeeChat/IRC (default)
+3 -1
View File
@@ -3,7 +3,7 @@
----
/exec -list
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <nom>] [-l|-o|-n|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] [-timeout <délai>] [-name <nom>] [-pipe <commande>] [-hsignal <nom>] <commande>
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <nom>] [-l|-o|-n|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] |-flush|-noflush] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] [-timeout <délai>] [-name <nom>] [-pipe <commande>] [-hsignal <nom>] <commande>
-in <id> <texte>
-inclose <id> [<texte>]
-signal <id> <signal>
@@ -30,6 +30,8 @@
-nosw: ne pas basculer vers le tampon de sortie
-ln: afficher les numéros de ligne (par défaut dans un nouveau tampon seulement)
-noln: ne pas afficher les numéros de ligne
-flush: afficher la sortie de la commande en temps réel (par défaut)
-noflush: afficher la sortie de la commande une fois qu'elle est terminée
-color: action sur les couleurs ANSI dans la sortie :
ansi: garder les codes ANSI tels quels
auto: convertir les couleurs ANSI en couleurs WeeChat/IRC (par défaut)
+3 -1
View File
@@ -3,7 +3,7 @@
----
/exec -list
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] [-flush|-noflush] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
-in <id> <text>
-inclose <id> [<text>]
-signal <id> <signal>
@@ -30,6 +30,8 @@
-nosw: don't switch to the output buffer
-ln: display line numbers (default in new buffer only)
-noln: don't display line numbers
-flush: display output of command in real time (default)
-noflush: display output of command after its end
-color: action on ANSI colors in output:
ansi: keep ANSI codes as-is
auto: convert ANSI colors to WeeChat/IRC (default)
+3 -1
View File
@@ -3,7 +3,7 @@
----
/exec -list
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] [-flush|-noflush] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
-in <id> <text>
-inclose <id> [<text>]
-signal <id> <signal>
@@ -30,6 +30,8 @@
-nosw: don't switch to the output buffer
-ln: display line numbers (default in new buffer only)
-noln: don't display line numbers
-flush: display output of command in real time (default)
-noflush: display output of command after its end
-color: action on ANSI colors in output:
ansi: keep ANSI codes as-is
auto: convert ANSI colors to WeeChat/IRC (default)
+3 -1
View File
@@ -3,7 +3,7 @@
----
/exec -list
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
[-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] [-l|-o|-n|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] [-flush|-noflush] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] [-timeout <timeout>] [-name <name>] [-pipe <command>] [-hsignal <name>] <command>
-in <id> <text>
-inclose <id> [<text>]
-signal <id> <signal>
@@ -30,6 +30,8 @@
-nosw: don't switch to the output buffer
-ln: display line numbers (default in new buffer only)
-noln: don't display line numbers
-flush: display output of command in real time (default)
-noflush: display output of command after its end
-color: action on ANSI colors in output:
ansi: keep ANSI codes as-is
auto: convert ANSI colors to WeeChat/IRC (default)