trigger: evaluate arguments of command when the trigger is created (closes #1472)

master
Sébastien Helleu 2020-04-12 09:30:56 +02:00
parent c9329f6fb1
commit 8bdd540df7
29 changed files with 308 additions and 238 deletions

View File

@ -21,6 +21,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features::
* buflist: evaluate option buflist.look.sort so that sort can be customized for each of the three buflist bar items (issue #1465)
* trigger: evaluate arguments of command when the trigger is created (issue #1472)
Bug fixes::

View File

@ -17,6 +17,31 @@ https://weechat.org/files/changelog/ChangeLog-devel.html[ChangeLog]
(file _ChangeLog.adoc_ in sources).
[[v2.9]]
== Version 2.9 (under dev)
[[v2.9_trigger_command_eval]]
=== Evaluation of trigger command arguments
The arguments for a trigger command (except the command itself) are now evaluated.
That means you can use for example new lines in the command description, like that:
----
/trigger add test command "test;test command;arg1 arg2;arg1: description 1${\n}arg2: description 2"
----
The command `/help test` will display this help in WeeChat:
----
[trigger] /test arg1 arg2
test command
arg1: description 1
arg2: description 2
----
[[v2.8]]
== Version 2.8 (2020-03-29)

View File

@ -20,69 +20,69 @@
default -yes
monitor [<filter>]
list: zeigt eine Liste aller Trigger (ohne Angabe von Argumente wird diese Liste standardmäßig ausgegeben)
listfull: zeigt eine detaillierte Liste, mit zusätzlichen Informationen, aller Trigger an
listdefault: zeigt die standardmäßig genutzten Trigger an
add: fügt einen Trigger hinzu
addoff: fügt einen Trigger hinzu (deaktiviert)
addreplace: erzeugt neuen Trigger oder ersetzt einen schon existierenden Trigger
name: Name des Trigger
list: list triggers (without argument, this list is displayed)
listfull: list triggers with detailed info for each trigger
listdefault: list default triggers
add: add a trigger
addoff: add a trigger (disabled)
addreplace: add or replace an existing trigger
name: name of trigger
hook: signal, hsignal, modifier, line, print, command, command_run, timer, config, focus, info, info_hashtable
arguments: Argumente für den Hook, abhängig vom genutzten Hook (getrennt durch Semikolon):
signal: Name(en) des signals (erforderlich)
hsignal: Name(en) des hsignal (erforderlich)
modifier: Name(en) des modifier (erforderlich)
line: Buffertyp ("formatted", "free" oder "*"), Liste von Buffermasken, Tags
print: Buffer, Tags, Nachricht, Farben entfernen
command: Befehl (erforderlich), Beschreibung, Argumente, Beschreibung der Argumente, Vervollständigung
command_run: Befehl(e) (erforderlich)
timer: Intervall (erforderlich), Anpassung an Sekunden (erforderlich), maximale Anzahl an Aufrufen
config: Name der Einstellung (erforderlich)
focus: Name(n) für sichtbaren Bereich (erforderlich) (z.B. "chat" für Chatbereich)
info: Name(n) der Information (erforderlich)
info_hashtable: Name(n) der Information (erforderlich)
conditions: evaluierte Bedingungen für den Trigger
regex: einer oder mehrere reguläre Ausdrücke um Zeichenketten in Variablen zu ersetzen
command: Befehl welcher ausgeführt werden soll (mehrere Befehle müssen durch ";" voneinander getrennt werden)
return_code: Rückgabewert für Callback (ok (standard), ok_eat, error)
post_action: Aktion welche nach der Abarbeitung des Triggers ausgeführt werden soll (none (Standardwert), disable, delete)
addinput: erstellt einen Trigger mit einer standardmäßigen Mustervorlage
input: kopiert den kompletten Trigger-Befehl in die Eingabezeile
output: schickt den Trigger-Befehl als Text in den Buffer
recreate: wie "input", allerdings wird die Einstellung "addreplace" anstelle von "add" genutzt
set: definiert, innerhalb eines Triggers, eine Einstellung neu
option: Name einer Einstellung: name, hook, arguments, conditions, regex, command, return_code
(um Hilfe über eine Einstellung zu erhalten: /help trigger.trigger.<name>.<option>)
value: neuer Wert für Einstellung
rename: benennt einen Trigger um
copy: kopiert einen Trigger
enable: aktiviert Trigger (ohne Angabe von Argumenten: aktiviert alle Trigger)
disable: deaktiviert Trigger (ohne Angabe von Argumenten: deaktiviert alle Trigger)
toggle: de-/aktiviert Trigger (ohne Angabe von Argumenten: de-/aktiviert alle Trigger)
restart: startet Trigger neu (Hook(s) werden neu erstellt)
show: zeigt detaillierte Informationen zu einem Trigger (inklusive einer kleinen Statistik)
del: entfernt einen Trigger
-all: führt eine Aktion aus, die alle Trigger beinhaltet
restore: stellt Trigger mit Standardwerten wieder her (funktioniert nur bei vorgegebenen Triggern)
default: stellt die standardmäßigen Trigger wieder her
monitor: öffnet den Trigger Monitor-Buffer, mit optionaler Filterfunktion:
Filter: zeigt Hooks/Trigger an (ein Hook muss mit "@" beginnen, zum Beispiel "@signal"), mehrere Filter können durch Kommata voneinander getrennt werden; Platzhalter "*" kann im Namen des Trigger verwendet werden
arguments: arguments for the hook, depending on hook (separated by semicolons):
signal: name(s) of signal (required)
hsignal: name(s) of hsignal (required)
modifier: name(s) of modifier (required)
line: buffer type ("formatted", "free" or "*"), list of buffer masks, tags
print: buffer, tags, message, strip colors
command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, see /help eval)
command_run: command(s) (required)
timer: interval (required), align on second, max calls
config: name(s) of option (required)
focus: name(s) of area (required)
info: name(s) of info (required)
info_hashtable: name(s) of info (required)
conditions: evaluated conditions for the trigger
regex: one or more regular expressions to replace strings in variables
command: command to execute (many commands can be separated by ";")
return_code: return code in callback (ok (default), ok_eat, error)
post_action: action to take after execution (none (default), disable, delete)
addinput: set input with default arguments to create a trigger
input: set input with the command used to create the trigger
output: send the command to create the trigger on the buffer
recreate: same as "input", with option "addreplace" instead of "add"
set: set an option in a trigger
option: name of option: name, hook, arguments, conditions, regex, command, return_code
(for help on option, you can type: /help trigger.trigger.<name>.<option>)
value: new value for the option
rename: rename a trigger
copy: copy a trigger
enable: enable trigger(s) (without arguments: enable triggers globally)
disable: disable trigger(s) (without arguments: disable triggers globally)
toggle: toggle trigger(s) (without arguments: toggle triggers globally)
restart: restart trigger(s) (recreate the hooks)
show: show detailed info on a trigger (with some stats)
del: delete a trigger
-all: do action on all triggers
restore: restore trigger(s) with the default values (works only for default triggers)
default: delete all triggers and restore default ones
monitor: open the trigger monitor buffer, with optional filter:
filter: filter hooks/triggers to display (a hook must start with "@", for example "@signal"), many filters can be separated by commas; wildcard "*" is allowed in each trigger name
Wenn ein Trigger-Callback aufgerufen wird, dann wird folgende Befehlskette ausgeführt:
1. Überprüfung von Bedingungen; falls unwahr, beenden
2. ersetze Text mittels einem oder mehreren erweiterten regulären POSIX Ausdrücken (sofern im Trigger definiert)
3. ein oder mehrere Befehle werden ausgeführt (sofern im Trigger definiert)
4. Beendigung mit einem Rückgabewert (ausgenommen sind modifiers, line, focus, info und info_hashtable)
5. Aktion welche nach der Abarbeitung des Triggers ausgeführt werden soll
When a trigger callback is called, following actions are performed, in this order:
1. check conditions; if false, exit
2. replace text using POSIX extended regular expression(s) (if defined in trigger)
3. execute command(s) (if defined in trigger)
4. exit with a return code (except for modifier, line, focus, info and info_hashtable)
5. perform post action
Beispiele (die standardmäßig verfügbaren Trigger kann man sich mit "/trigger listdefault" anzeigen lassen):
fügt einer Nachricht die Textattribute *fett*, _unterstrichen_ und /kursiv/ hinzu:
Examples (you can also look at default triggers with /trigger listdefault):
add text attributes *bold*, _underline_ and /italic/ (only in user messages):
/trigger add effects modifier weechat_print "${tg_tag_nick}" "==\*([^ ]+)\*==*${color:bold}${re:1}${color:-bold}*== ==_([^ ]+)_==_${color:underline}${re:1}${color:-underline}_== ==/([^ ]+)/==/${color:italic}${re:1}${color:-italic}/"
verbirgt die Nicklist auf kleineren Terminals:
hide nicklist bar on small terminals:
/trigger add resize_small signal signal_sigwinch "${info:term_width} < 100" "" "/bar hide nicklist"
/trigger add resize_big signal signal_sigwinch "${info:term_width} >= 100" "" "/bar show nicklist"
speichert die Konfiguration jede Stunde ab:
silently save config each hour:
/trigger add cfgsave timer 3600000;0;0 "" "" "/mute /save"
öffnet den Trigger Monitor und zeigt ausschließlich modifier und Trigger an, die mit "resize" im Namen beginnen:
open trigger monitor and show only modifiers and triggers whose name starts with "resize":
/trigger monitor @modifier,resize*
----

View File

@ -3923,14 +3923,16 @@ ein Semikolon getrennt.
`+*;;;1+` |
link:weechat_plugin_api.en.html#_hook_print[hook_print] (Englisch)
// TRANSLATION MISSING
| command |
1. Befehlsname (Priorität erlaubt) (erforderlich) +
2. Beschreibung +
3. Argumente +
4. Beschreibung der Argumente +
5. Vervollständigung |
2. Beschreibung (evaluated, siehe Befehl <<command_weechat_eval,/eval>>) +
3. Argumente (evaluated, siehe Befehl <<command_weechat_eval,/eval>>) +
4. Beschreibung der Argumente (evaluated, siehe Befehl <<command_weechat_eval,/eval>>) +
5. Vervollständigung (evaluated, siehe Befehl <<command_weechat_eval,/eval>>) |
`+test+` +
`+5000\|test+` |
`+5000\|test+` +
`+test;test command;arg1 arg2;arg1: description 1${\n}arg2: description 2+` |
link:weechat_plugin_api.en.html#_hook_command[hook_command] (Englisch)
| command_run |

View File

@ -34,7 +34,7 @@ listdefault: list default triggers
modifier: name(s) of modifier (required)
line: buffer type ("formatted", "free" or "*"), list of buffer masks, tags
print: buffer, tags, message, strip colors
command: command (required), description, arguments, description of arguments, completion
command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, see /help eval)
command_run: command(s) (required)
timer: interval (required), align on second, max calls
config: name(s) of option (required)

View File

@ -3839,12 +3839,13 @@ The arguments depend on the hook used. They are separated by semicolons.
| command |
1. command name (priority allowed) (required) +
2. description +
3. arguments +
4. description of arguments +
5. completion |
2. description (evaluated, see command <<command_weechat_eval,/eval>>) +
3. arguments (evaluated, see command <<command_weechat_eval,/eval>>) +
4. description of arguments (evaluated, see command <<command_weechat_eval,/eval>>) +
5. completion (evaluated, see command <<command_weechat_eval,/eval>>) |
`+test+` +
`+5000\|test+` |
`+5000\|test+` +
`+test;test command;arg1 arg2;arg1: description 1${\n}arg2: description 2+` |
link:weechat_plugin_api.en.html#_hook_command[hook_command]
| command_run |

View File

@ -34,7 +34,7 @@ listdefault : lister les triggers par défaut
modifier : nom(s) de modificateur (obligatoire)
line : type de tampon ("formatted", "free" ou "*"), liste de masques de tampons, étiquettes
print : tampon, étiquettes, message, suppression des couleurs (0/1)
command : commande (obligatoire), description, paramètres, description des paramètres, complétion
command : commande (obligatoire), description, paramètres, description des paramètres, complétion (tous les paramètres sauf la commande sont évalués, voir /help eval)
command_run : commande(s) (obligatoire)
timer : intervalle (obligatoire), alignement sur la seconde, nombre max d'appels
config : nom(s) de l'option (obligatoire)

View File

@ -3965,12 +3965,13 @@ points-virgules.
| command |
1. nom de commande (priorité autorisée) (obligatoire) +
2. description +
3. paramètres +
4. description des paramètres +
5. complétion |
2. description (évalué, voir la commande <<command_weechat_eval,/eval>>) +
3. paramètres (évalué, voir la commande <<command_weechat_eval,/eval>>) +
4. description des paramètres (évalué, voir la commande <<command_weechat_eval,/eval>>) +
5. complétion (évalué, voir la commande <<command_weechat_eval,/eval>>) |
`+test+` +
`+5000\|test+` |
`+5000\|test+` +
`+test;commande de test;arg1 arg2;arg1: description 1${\n}arg2: description 2+` |
link:weechat_plugin_api.fr.html#_hook_command[hook_command]
| command_run |

View File

@ -34,7 +34,7 @@ listdefault: list default triggers
modifier: name(s) of modifier (required)
line: buffer type ("formatted", "free" or "*"), list of buffer masks, tags
print: buffer, tags, message, strip colors
command: command (required), description, arguments, description of arguments, completion
command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, see /help eval)
command_run: command(s) (required)
timer: interval (required), align on second, max calls
config: name(s) of option (required)

View File

@ -4131,12 +4131,13 @@ The arguments depend on the hook used. They are separated by semicolons.
| command |
1. command name (priority allowed) (required) +
2. description +
3. arguments +
4. description of arguments +
5. completion |
2. description (evaluated, see command <<command_weechat_eval,/eval>>) +
3. arguments (evaluated, see command <<command_weechat_eval,/eval>>) +
4. description of arguments (evaluated, see command <<command_weechat_eval,/eval>>) +
5. completion (evaluated, see command <<command_weechat_eval,/eval>>) |
`+test+` +
`+5000\|test+` |
`+5000\|test+` +
`+test;test command;arg1 arg2;arg1: description 1${\n}arg2: description 2+` |
link:weechat_plugin_api.it.html#_hook_command[hook_command]
| command_run |

View File

@ -20,69 +20,69 @@
default -yes
monitor [<filter>]
list: トリガをリストアップ (引数なしの場合、このリストを表示します)
listfull: 各トリガに関する詳細な情報を付けてトリガをリストアップ
listdefault: デフォルトトリガをリストアップ
add: トリガを追加
addoff: トリガを追加 (無効状態で)
addreplace: 追加または存在するトリガを置換
name: トリガの名前
hook: signal、hsignal、modifier、line、print、command、command_run、timer、config、focus、info、info_hashtable
arguments: フックの引数、フックの種類に依存 (セミコロンで区切る):
signal: シグナルの名前 (必須)
hsignal: hsignal の名前 (必須)
modifier: modifier の名前 (必須)
line: バッファ型 ("formatted"、"free"、"*")、バッファマスクおよびタグのリスト
print: バッファ、タグ、メッセージ、色の削除
command: コマンド (必須)、説明、引数、引数の説明、補完
command_run: コマンド (必須)
timer: インターバル (必須)、秒の調節、最大呼び出し回数
config: オプションの名前 (必須)
focus: エリアの名前 (必須)
info: インフォ名 (必須)
info_hashtable: インフォ名 (必須)
conditions: トリガの実行条件
regex: 変数内の文字列を置換する 1 つ以上の正規表現
command: 実行するコマンド (複数のコマンドは ";" で区切ってください)
return_code: コールバック内のリターンコード (ok (デフォルト)、ok_eat、error)
post_action: トリガ実行後の処遇 (none (デフォルト、何もしない)、disable (無効化)、delete (削除))
addinput: 入力にトリガを作る際のデフォルト引数を設定
input: 入力にトリガを作る際に使われるコマンドを設定
output: バッファでトリガを作る際のコマンドを送信
recreate: "add" の代わりに "addreplace" オプションを使うことを除いて "input" と同じ
set: トリガにオプションを設定
option: オプションの名前: name、hook、arguments、conditions、regex、command、return_code
(オプションに関するヘルプを見るには: /help trigger.trigger.<name>.<option>)
value: オプションの新しい値
rename: トリガの名前を変更
copy: トリガをコピー
enable: トリガを有効化 (引数なしの場合: 大域的にトリガを有効化)
disable: トリガを無効化 (引数なしの場合: 大域的にトリガを無効化)
toggle: トリガの有効無効を切り替え (引数なしの場合: 大域的にトリガの有効無効を切り替え)
restart: トリガの再開 (フックを再作成)
show: トリガに関する情報を表示 (状態を含めて)
del: トリガを削除
-all: 全てのトリガに関するアクションを実行
restore: デフォルトの値でトリガを復元 (これができるのはデフォルトトリガに限ります)
default: 全てのトリガを削除してデフォルトのトリガを復元
monitor: 任意でフィルタを付けてトリガ監視バッファを開く:
filter: フックおよびトリガをフィルタして表示 (フックは必ず "@" で始めてください、たとえば "@signal")、複数のフィルタをかける場合はそれぞれをコンマで区切ってください; 各トリガ名にワイルドカード "*" を使うことができます。
list: list triggers (without argument, this list is displayed)
listfull: list triggers with detailed info for each trigger
listdefault: list default triggers
add: add a trigger
addoff: add a trigger (disabled)
addreplace: add or replace an existing trigger
name: name of trigger
hook: signal, hsignal, modifier, line, print, command, command_run, timer, config, focus, info, info_hashtable
arguments: arguments for the hook, depending on hook (separated by semicolons):
signal: name(s) of signal (required)
hsignal: name(s) of hsignal (required)
modifier: name(s) of modifier (required)
line: buffer type ("formatted", "free" or "*"), list of buffer masks, tags
print: buffer, tags, message, strip colors
command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, see /help eval)
command_run: command(s) (required)
timer: interval (required), align on second, max calls
config: name(s) of option (required)
focus: name(s) of area (required)
info: name(s) of info (required)
info_hashtable: name(s) of info (required)
conditions: evaluated conditions for the trigger
regex: one or more regular expressions to replace strings in variables
command: command to execute (many commands can be separated by ";")
return_code: return code in callback (ok (default), ok_eat, error)
post_action: action to take after execution (none (default), disable, delete)
addinput: set input with default arguments to create a trigger
input: set input with the command used to create the trigger
output: send the command to create the trigger on the buffer
recreate: same as "input", with option "addreplace" instead of "add"
set: set an option in a trigger
option: name of option: name, hook, arguments, conditions, regex, command, return_code
(for help on option, you can type: /help trigger.trigger.<name>.<option>)
value: new value for the option
rename: rename a trigger
copy: copy a trigger
enable: enable trigger(s) (without arguments: enable triggers globally)
disable: disable trigger(s) (without arguments: disable triggers globally)
toggle: toggle trigger(s) (without arguments: toggle triggers globally)
restart: restart trigger(s) (recreate the hooks)
show: show detailed info on a trigger (with some stats)
del: delete a trigger
-all: do action on all triggers
restore: restore trigger(s) with the default values (works only for default triggers)
default: delete all triggers and restore default ones
monitor: open the trigger monitor buffer, with optional filter:
filter: filter hooks/triggers to display (a hook must start with "@", for example "@signal"), many filters can be separated by commas; wildcard "*" is allowed in each trigger name
トリガコールバックを呼び出す際には、以下の順番通りにアクションを実行します:
1. 条件を確認; 偽の場合、終了
2. POSIX 拡張正規表現を使ってテキストを置換 (トリガに定義されている場合)
3. コマンドを実行 (トリガに定義されている場合)
4. リターンコードを返して終了 (modifier、line、focus、info、info_hashtable を除く)
5. トリガ実行後の処遇を適用
When a trigger callback is called, following actions are performed, in this order:
1. check conditions; if false, exit
2. replace text using POSIX extended regular expression(s) (if defined in trigger)
3. execute command(s) (if defined in trigger)
4. exit with a return code (except for modifier, line, focus, info and info_hashtable)
5. perform post action
例 (/trigger listdefault でデフォルトトリガを見ることができます):
テキスト属性 *太字*、_下線_、/イタリック/ を追加 (ユーザメッセージのみ):
Examples (you can also look at default triggers with /trigger listdefault):
add text attributes *bold*, _underline_ and /italic/ (only in user messages):
/trigger add effects modifier weechat_print "${tg_tag_nick}" "==\*([^ ]+)\*==*${color:bold}${re:1}${color:-bold}*== ==_([^ ]+)_==_${color:underline}${re:1}${color:-underline}_== ==/([^ ]+)/==/${color:italic}${re:1}${color:-italic}/"
狭い端末ではニックネームリストバーを隠す:
hide nicklist bar on small terminals:
/trigger add resize_small signal signal_sigwinch "${info:term_width} < 100" "" "/bar hide nicklist"
/trigger add resize_big signal signal_sigwinch "${info:term_width} >= 100" "" "/bar show nicklist"
設定を 1 時間毎に黙々と保存:
silently save config each hour:
/trigger add cfgsave timer 3600000;0;0 "" "" "/mute /save"
トリガモニタを開き、修飾子と名前が "resize" から始まるトリガだけを表示:
open trigger monitor and show only modifiers and triggers whose name starts with "resize":
/trigger monitor @modifier,resize*
----

View File

@ -3866,14 +3866,16 @@ trigger.trigger.beep.post_action = none
`+*;;;1+` |
link:weechat_plugin_api.ja.html#_hook_print[hook_print]
// TRANSLATION MISSING
| command |
1. コマンド名 (優先度の指定も可) (必須) +
2. 説明 +
3. 引数 +
4. 引数の説明 +
5. 補完 |
2. 説明 (evaluated, <<command_weechat_eval,/eval>> コマンドを参照) +
3. 引数 (evaluated, <<command_weechat_eval,/eval>> コマンドを参照) +
4. 引数の説明 (evaluated, <<command_weechat_eval,/eval>> コマンドを参照) +
5. 補完 (evaluated, <<command_weechat_eval,/eval>> コマンドを参照) |
`+test+` +
`+5000\|test+` |
`+5000\|test+` +
`+test;test command;arg1 arg2;arg1: description 1${\n}arg2: description 2+` |
link:weechat_plugin_api.ja.html#_hook_command[hook_command]
| command_run |

View File

@ -20,69 +20,69 @@
default -yes
monitor [<filtr>]
list: lista triggerów (jeśli nie podano argumentu, wyświetli się ta lista)
listfull: lista triggerów ze szczegółowymi informacjami
listdefault: lista domyślnych triggerów
add: dodaje trigger
addoff: dodaje trigger (wyłączony)
addreplace: dodaje lub zastępuje istniejący trigger
nazwa: nazwa triggera
list: list triggers (without argument, this list is displayed)
listfull: list triggers with detailed info for each trigger
listdefault: list default triggers
add: add a trigger
addoff: add a trigger (disabled)
addreplace: add or replace an existing trigger
name: name of trigger
hook: signal, hsignal, modifier, line, print, command, command_run, timer, config, focus, info, info_hashtable
argumenty: argumenty dla uchwytu, w zależności od jego typu (oddzielone średnikami):
signal: nazwa(-y) signal (wymagane)
hsignal: nazwa(-y) hsignal (wymagane)
modifier: nazwa(-y) modifier (wymagane)
line: typ bufora("formatted", "free" lub "*"), lista mask buforów, tagi
print: bufor, tagi, wiadomość, pomiń kolory
command: komenda (wymagane), opis, argumenty, opis argumentów, dopełnienie
command_run: komenda(-y) (wymagane)
timer: interwał (wymagane), wyrównanie sekund, ilość wywołań
config: nazwa(-y) opcji (wymagane)
focus: nazwa(-y) obszarów (wymagane)
info: nazwa(y) informacji (wymagane)
info_hashtable: nazwa(y) informacji (wymagane)
warunki: przetwarzane warunki dla triggera
regex: jedno lub więcej wyrażeń regularnych do zastępowania ciągów w zmiennych
komenda: komenda do wykonania (wiele komend można oddzielić ";")
zwracany_kod: kod zwracany w callbacku (ok (domyślne), ok_eat, error)
post_action: akcja do wykonania po zakończeniu (none (domyślne), disable, delete)
addinput: ustawia wejście z domyślnymi argumentami do stworzenia triggera
input: ustawia wejście z komendą użytą do stworzenia triggera
output: wysyła komendę do stworzenia triggera do buforu
recreate: tak samo jak "input", z opcją "addreplace" zamiast "add"
set: ustawia opcje triggera
opcja: nazwa opcji: name, hook, arguments, conditions, regex, command, return_code
(aby uzyskać pomoc na temat opcji możesz wpisać: /help trigger.trigger.<nazwa>.<opcja>)
wartość: nowa wartość dla opcji
rename: zmienia nazwę triggera
copy: kopiuje trigger
enable: włącza trigger(y) (bez argumentów: włącza triggery globalnie)
disable: wyłącza trigger(y) (bez argumentów: wyłącza triggery globalnie)
toggle: zmienia stan triggera(-ów) (bez argumentów: zmienia stan triggerów globalnie)
restart: restartuje trigger(y) (tworzy na nowo uchwyty)
show: pokazuje szczegółowe informacje o triggerze (z niektórymi statystykami)
del: usuwa trigger
-all: wykonaj akcję na wszystkich triggerach
restore: przywraca trigger(y) z domyślnymi wartościami (działa tylko dla domyślnych triggerów)
default: przywraca domyślne triggery
monitor: otwiera bufor monitorowania triggerów, z opcjonalnym filtrem:
filtr: filtruje uchwyty/triggery do wyświetlenia (uchwyt musi się zaczynać od "@", na przykład "@signal"), wiele filtrów może być oddzielonych przecinkiem; dzika karta "*" jest dozwolona w nazwie każdego triggera
arguments: arguments for the hook, depending on hook (separated by semicolons):
signal: name(s) of signal (required)
hsignal: name(s) of hsignal (required)
modifier: name(s) of modifier (required)
line: buffer type ("formatted", "free" or "*"), list of buffer masks, tags
print: buffer, tags, message, strip colors
command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, see /help eval)
command_run: command(s) (required)
timer: interval (required), align on second, max calls
config: name(s) of option (required)
focus: name(s) of area (required)
info: name(s) of info (required)
info_hashtable: name(s) of info (required)
conditions: evaluated conditions for the trigger
regex: one or more regular expressions to replace strings in variables
command: command to execute (many commands can be separated by ";")
return_code: return code in callback (ok (default), ok_eat, error)
post_action: action to take after execution (none (default), disable, delete)
addinput: set input with default arguments to create a trigger
input: set input with the command used to create the trigger
output: send the command to create the trigger on the buffer
recreate: same as "input", with option "addreplace" instead of "add"
set: set an option in a trigger
option: name of option: name, hook, arguments, conditions, regex, command, return_code
(for help on option, you can type: /help trigger.trigger.<name>.<option>)
value: new value for the option
rename: rename a trigger
copy: copy a trigger
enable: enable trigger(s) (without arguments: enable triggers globally)
disable: disable trigger(s) (without arguments: disable triggers globally)
toggle: toggle trigger(s) (without arguments: toggle triggers globally)
restart: restart trigger(s) (recreate the hooks)
show: show detailed info on a trigger (with some stats)
del: delete a trigger
-all: do action on all triggers
restore: restore trigger(s) with the default values (works only for default triggers)
default: delete all triggers and restore default ones
monitor: open the trigger monitor buffer, with optional filter:
filter: filter hooks/triggers to display (a hook must start with "@", for example "@signal"), many filters can be separated by commas; wildcard "*" is allowed in each trigger name
Kiedy callback triggera jest wywoływany, wykonywane są następujące akcje, w kolejności:
1. sprawdzenie warunków; jeśli nie są spełnione, wyjście
2. zastąpienie tekstu za pomocą rozszerzonych wyrażeń regularnych POSIX (jeśli zdefiniowane)
3. wykonanie komend(y) (jeśli zdefiniowane)
4. wyjście z kodem wyjścia (poza modifiers i focus)
5. wykonanie akcji kończącej
When a trigger callback is called, following actions are performed, in this order:
1. check conditions; if false, exit
2. replace text using POSIX extended regular expression(s) (if defined in trigger)
3. execute command(s) (if defined in trigger)
4. exit with a return code (except for modifier, line, focus, info and info_hashtable)
5. perform post action
Przykłady (możesz też spojrzeć na domyślne triggery za pomocą /trigger listdefault):
dodaje atrybuty tekstu *bold*, _underline_ i /italic/ (tylko w wiadomościach użytkowników):
Examples (you can also look at default triggers with /trigger listdefault):
add text attributes *bold*, _underline_ and /italic/ (only in user messages):
/trigger add effects modifier weechat_print "${tg_tag_nick}" "==\*([^ ]+)\*==*${color:bold}${re:1}${color:-bold}*== ==_([^ ]+)_==_${color:underline}${re:1}${color:-underline}_== ==/([^ ]+)/==/${color:italic}${re:1}${color:-italic}/"
ukrywa pasek z nickami na małych terminalach:
hide nicklist bar on small terminals:
/trigger add resize_small signal signal_sigwinch "${info:term_width} < 100" "" "/bar hide nicklist"
/trigger add resize_big signal signal_sigwinch "${info:term_width} >= 100" "" "/bar show nicklist"
cichy zapis plików konfiguracyjnych co każdą godzinę:
silently save config each hour:
/trigger add cfgsave timer 3600000;0;0 "" "" "/mute /save"
otwiera monitor triggerów i pokazuje tylko modifiers i triggery, których nazwa zaczyna się od "resize":
open trigger monitor and show only modifiers and triggers whose name starts with "resize":
/trigger monitor @modifier,resize*
----

View File

@ -3864,14 +3864,16 @@ Argumenty zależą od rodzaju uchwytu. Są oddzielane średnikami.
`+*;;;1+` |
link:weechat_plugin_api.en.html#_hook_print[hook_print] (Angielski)
// TRANSLATION MISSING
| command |
1. nazwa komendy dozwolony priorytet) (wymagane) +
2. opis +
3. argumenty +
4. opis argumentów +
5. dopełnienie |
2. opis (evaluated, zobacz komendę <<command_weechat_eval,/eval>>) +
3. argumenty (evaluated, zobacz komendę <<command_weechat_eval,/eval>>) +
4. opis argumentów (evaluated, zobacz komendę <<command_weechat_eval,/eval>>) +
5. dopełnienie (evaluated, zobacz komendę <<command_weechat_eval,/eval>>) |
`+test+` +
`+5000\|test+` |
`+5000\|test+` +
`+test;test command;arg1 arg2;arg1: description 1${\n}arg2: description 2+` |
link:weechat_plugin_api.en.html#_hook_command[hook_command] (Angielski)
| command_run |

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -12333,7 +12333,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2020-04-03 20:03+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@ -14407,6 +14407,7 @@ msgstr ""
"<name>|-all [<name>...] || show <name> || del <name>|-all [<name>...] || "
"restore <name> [<name>...] || default -yes || monitor [<filter>]"
#, fuzzy
msgid ""
" list: list triggers (without argument, this list is displayed)\n"
" listfull: list triggers with detailed info for each trigger\n"
@ -14426,7 +14427,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -12611,7 +12611,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"PO-Revision-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2020-04-12 08:46+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -14118,7 +14118,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
@ -14212,7 +14213,8 @@ msgstr ""
" print : tampon, étiquettes, message, suppression des couleurs "
"(0/1)\n"
" command : commande (obligatoire), description, paramètres, "
"description des paramètres, complétion\n"
"description des paramètres, complétion (tous les paramètres sauf la commande "
"sont évalués, voir /help eval)\n"
" command_run : commande(s) (obligatoire)\n"
" timer : intervalle (obligatoire), alignement sur la seconde, "
"nombre max d'appels\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -11581,7 +11581,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -12839,7 +12839,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@ -13535,6 +13535,7 @@ msgstr ""
"<name>|-all [<name>...] || show <name> || del <name>|-all [<name>...] || "
"restore <name> [<name>...] || default -yes || monitor [<filter>]"
#, fuzzy
msgid ""
" list: list triggers (without argument, this list is displayed)\n"
" listfull: list triggers with detailed info for each trigger\n"
@ -13554,7 +13555,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2020-04-05 13:44+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@ -13788,6 +13788,7 @@ msgstr ""
"[<nazwa>...] || show <nazwa> || del <nazwa>|-all [<nazwa>...] || restore "
"<nazwa> [<nazwa>...] || default -yes || monitor [<filtr>]"
#, fuzzy
msgid ""
" list: list triggers (without argument, this list is displayed)\n"
" listfull: list triggers with detailed info for each trigger\n"
@ -13807,7 +13808,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@ -13401,7 +13401,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2019-11-03 08:38+0100\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -12063,7 +12063,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -11616,7 +11616,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2019-11-03 08:38+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -10609,7 +10609,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-04-06 20:37+0200\n"
"POT-Creation-Date: 2020-04-12 08:46+0200\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -10447,7 +10447,8 @@ msgid ""
"buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command are "
"evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -1170,7 +1170,8 @@ trigger_command_init ()
"list of buffer masks, tags\n"
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion\n"
"description of arguments, completion (all arguments except command "
"are evaluated, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"

View File

@ -265,6 +265,7 @@ trigger_hook (struct t_trigger *trigger)
{
char **argv, **argv_eol, *buffer_type, *buffer_name, *tags, *message;
char *error1, *error2, *error3;
char *eval_desc, *eval_args, *eval_desc_args, *eval_completion;
int i, argc, strip_colors;
long interval, align_second, max_calls;
@ -400,14 +401,30 @@ trigger_hook (struct t_trigger *trigger)
if (trigger->hooks)
{
trigger->hooks_count = 1;
eval_desc = (argc > 1) ? weechat_string_eval_expression (
argv[1], NULL, NULL, NULL) : NULL;
eval_args = (argc > 2) ? weechat_string_eval_expression (
argv[2], NULL, NULL, NULL) : NULL;
eval_desc_args = (argc > 3) ? weechat_string_eval_expression (
argv[3], NULL, NULL, NULL) : NULL;
eval_completion = (argc > 4) ? weechat_string_eval_expression (
argv[4], NULL, NULL, NULL) : NULL;
trigger->hooks[0] = weechat_hook_command (
argv[0], /* command */
(argc > 1) ? argv[1] : "", /* description */
(argc > 2) ? argv[2] : "", /* arguments */
(argc > 3) ? argv[3] : "", /* description of args */
(argc > 4) ? argv[4] : "", /* completion */
(eval_desc) ? eval_desc : "",
(eval_args) ? eval_args : "",
(eval_desc_args) ? eval_desc_args : "",
(eval_completion) ? eval_completion : "",
&trigger_callback_command_cb,
trigger, NULL);
if (eval_desc)
free (eval_desc);
if (eval_args)
free (eval_args);
if (eval_desc_args)
free (eval_desc_args);
if (eval_completion)
free (eval_completion);
}
}
break;