core: add command /toggle

This commit is contained in:
Sébastien Helleu 2021-10-01 22:55:38 +02:00
parent 9548a4cf74
commit ad5fa7c99f
33 changed files with 2188 additions and 128 deletions

View File

@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features::
* core: add command /toggle
* api: add user variables in evaluation of expressions with "define:name,value"
Bug fixes::

View File

@ -1337,126 +1337,126 @@ infolists: zeigt Information über die Infolists an
/eval [-n|-s] [-d] <expression>
[-n] [-d [-d]] -c <expression1> <operator> <expression2>
-n: display result without sending it to buffer (debug mode)
-s: split expression before evaluating it (many commands can be separated by semicolons)
-d: display debug output after evaluation (with two -d: more verbose debug)
-c: evaluate as condition: use operators and parentheses, return a boolean value ("0" or "1")
expression: expression to evaluate, variables with format ${variable} are replaced (see below); many commands can be separated by semicolons
operator: a logical or comparison operator:
- logical operators:
&& boolean "and"
|| boolean "or"
- comparison operators:
== equal
!= not equal
<= less or equal
< less
>= greater or equal
> greater
=~ is matching POSIX extended regex
!~ is NOT matching POSIX extended regex
==* is matching mask, case sensitive (wildcard "*" is allowed)
!!* is NOT matching mask, case sensitive (wildcard "*" is allowed)
=* is matching mask, case insensitive (wildcard "*" is allowed)
!* is NOT matching mask, case insensitive (wildcard "*" is allowed)
==- is included, case sensitive
!!- is NOT included, case sensitive
=- is included, case insensitive
!- is NOT included, case insensitive
-n: gibt das Ergebnis aus, ohne dass dieses in den Buffer gesendet wird (debug Modus)
-s: teilt Ausdrücke, bevor sie evaluiert werden (mehrere Befehle können durch Semikolon getrennt werden)
-d: eine Debug-Ausgabe nach Auswertung anzeigen (Nutzung von zwei -d: ausführliche Debug-Ausgabe)
-c: Auswertung als Bedingung: nutzt Operatoren und runde Klammern, Rückgabewert als Boolean-Wert ("0" oder "1")
expression: Ausdruck welcher verarbeitet werden soll. Variablen im Format ${variable} werden ersetzt (siehe unten); mehrere Befehle werden durch ein Semikolon voneinander getrennt
operator: ein logischer oder vergleichender Operand:
- logische Operanden:
&& boolean "und"
|| boolean "oder"
- vergleichende Operanden:
== gleich
!= ungleich
<= kleiner oder gleich
< kleiner
>= größer oder gleich
> größer
=~ stimmt mit regulärem POSIX Ausdruck überein
!~ stimmt NICHT mit regulärem POSIX Ausdruck überein
==* stimmt mit Maske überein (Platzhalter "*" ist erlaubt)
!!* stimmt mit Maske NICHT überein (Platzhalter "*" ist erlaubt)
=* stimmt mit Maske überein, Groß- und Kleinschreibung wird nicht beachtet (Platzhalter "*" ist erlaubt)
!* stimmt mit Maske NICHT überein, Groß- und Kleinschreibung wird nicht beachtet (Platzhalter "*" ist erlaubt)
==- ist enthalten, Groß- und Kleinschreibung wird beachtet
!!- ist NICHT enthalten, Groß- und Kleinschreibung wird beachtet
=- ist enthalten, Groß- und Kleinschreibung wird nicht beachtet
!- ist NICHT enthalten, Groß- und Kleinschreibung wird nicht beachtet
An expression is considered as "true" if it is not NULL, not empty, and different from "0".
The comparison is made using floating point numbers if the two expressions are valid numbers, with one of the following formats:
- integer (examples: 5, -7)
- floating point number (examples: 5.2, -7.5, 2.83e-2)
- hexadecimal number (examples: 0xA3, -0xA3)
To force a string comparison, you can add double quotes around each expression, for example:
Ein Ausdruck gilt als "wahr" sofern das Ergebnis weder NULL, nicht leer und von "0" abweichend ist.
Für einen Vergleich werden Fließkommazahlen genutzt, insofern es sich bei beiden Ausdrücken um gültige Zahlen handelt, folgende Formate werden unterstützt:
- Integer (Beispiele: 5, -7)
- Fließkommazahl (Beispiele: 5.2, -7.5, 2.83e-2)
- hexadezimale Zahl (Beispiele: 0xA3, -0xA3)
Um einen Vergleich zwischen zwei Zeichenketten zu erzwingen, müssen die Ausdrücke in Anführungszeichen gesetzt werden, zum Beispiel:
50 > 100 ==> 0
"50" > "100" ==> 1
Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority:
1. the string itself without evaluation (format: "raw:xxx")
2. a user-defined variable (format: "name")
3. an evaluated sub-string (format: "eval:xxx")
4. an evaluated condition (format: "eval_cond:xxx")
5. a string with escaped chars (format: "esc:xxx" or "\xxx")
6. a string with chars to hide (format: "hide:char,string")
7. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
8. a reversed string (format: "rev:xxx" or "revscr:xxx")
9. a repeated string (format: "repeat:count,string")
10. length of a string (format: "length:xxx" or "lengthscr:xxx")
11. split of a string (format: "split:number,separators,flags,xxx")
12. split of shell argmuents (format: "split_shell:number,xxx")
13. a color (format: "color:xxx", see "Plugin API reference", function "color")
14. a modifier (format: "modifier:name,data,string")
15. an info (format: "info:name,arguments", arguments are optional)
16. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
17. current date/time (format: "date" or "date:format")
18. an environment variable (format: "env:XXX")
19. a ternary operator (format: "if:condition?value_if_true:value_if_false")
20. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
21. a random integer number (format: "random:min,max")
22. a translated string (format: "translate:xxx")
23. define a user variable (format: "define:name,value")
24. an option (format: "file.section.option")
25. a local variable in buffer
26. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
Format for hdata can be one of following:
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
hdata[list].var1.var2...: start with a hdata using a list/pointer/pointer name, for example:
${buffer[gui_buffers].full_name}: full name of first buffer in linked list of buffers
${plugin[weechat_plugins].name}: name of first plugin in linked list of plugins
hdata[pointer].var1.var2...: start with a hdata using a pointer, for example:
${buffer[0x1234abcd].full_name}: full name of the buffer with this pointer (can be used in triggers)
${buffer[my_pointer].full_name}: full name of the buffer with this pointer name (can be used in triggers)
For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get".
Einige Variablen werden im Ausdruck mittels der Formatierung ${variable} ersetzt. Mögliche Variablen sind, nach Reihenfolge ihrer Priorität:
1. die Zeichenfolge selbst ohne Auswertung (Format: "raw:xxx")
2. eine benutzerdefinierte Variable (Format: "name")
3. eine evaluierte Teilzeichenkette (Format: "eval:xxx")
4. eine evaluierte Bedingung (Format: "eval_cond:xxx")
5. eine Zeichenkette mit Escapesequenzen (Format: "esc:xxx" oder "\xxx")
6. Zeichen, die in einer Zeichenkette nicht dargestellt werden sollen (Format: "hide:Zeichen,Zeichenkette")
7. eine Zeichenkette mit einer maximalen Anzahl an Zeichen (Format: "cut:max,suffix,string" oder "cut:+max,suffix,string")
oder maximale Anzahl an Zeichen die auf dem Bildschirm angezeigt werden sollen (Format: "cutscr:Max,Suffix,Zeichenkette oder "cutscr:+Max,Suffix,Zeichenkette")
8. eine Zeichenkette umkehren (Format: "rev:xxx" oder "revscr:xxx")
9. eine Zeichenkette wiederholen (Format: "repeat:Anzahl,Zeichenkette")
10. Länge einer Zeichenkette (Format: "length:xxx" oder "lengthscr:xxx")
11. Aufteilen einer Zeichenkette (Format: "split:Anzahl,Trennzeichen,Flags,xxx")
12. Aufteilen von Shell-Argumenten (Format: "split_shell:Anzahl,xxx")
13. eine Farbe (Format: "color:xxx", siehe "Anleitung für API Erweiterung", Funktion "color")
14. zum modifizieren (Format: "modifier:name,data,string")
15. eine Info (Format: "Info:Name,Argumente", Argumente sind optional)
16. eine Basis 16/32/64 kodierte / dekodierte Zeichenfolge (Format: "base_encode:base,xxx" oder "base_decode:base,xxx")
17. aktuelles Datum/Uhrzeit (Format: "date" oder "date:format")
18. eine Umgebungsvariable (Format: "env:XXX")
19. ein Dreifachoperand (Format: "if:Bedingung?Wert_falls_wahr:Wert_falls_unwahr")
20. Ergebnis eines Ausdrucks mit Klammern und Operatoren + - * / // % ** (Format: "calc:xxx")
21. eine zufällige ganze Zahl (Format: "random:min,max")
22. eine übersetzte Zeichenkette (Format: "translate:xxx")
23. eine Benutzervariable definieren (Format: "define:Name,Wert")
24. eine Option (Format: "file.section.option")
25. eine lokale Variable eines Buffers
26. ein(e) hdata - Name/Variable (der Wert wird automatisch in eine Zeichenkette konvertiert), standardmäßig wird für "window" und "buffer" das aktuelle Fenster/Buffer verwendet.
Das Format für hdata kann wie folgt aufgebaut sein:
hdata.var1.var2...: startet mit hdata (der Pointer muss bekannt sein) und fragt eine Variable nach der anderen ab (weitere hdata können folgen)
hdata[list].var1.var2...: startet hdata mittels einer Liste, zum Beispiel:
${buffer[gui_buffers].full_name}: der vollständige Name des ersten Buffers, in der verknüpften Liste aller Buffer
${plugin[weechat_plugins].name}: Name der ersten Erweiterung, in der verknüpften Liste aller Erweiterungen
hdata[pointer].var1.var2...: startet hdata mittels einem Pointer, zum Beispiel:
${buffer[0x1234abcd].full_name}: vollständiger Name eines Buffers und des dazugehörigen Pointers (kann in triggern benutzt werden)
${buffer[my_pointer].full_name}: vollständiger Name des Buffers mit dem entsprechenden Pointernamen (kann in Triggern verwendet werden)
Die vorhandenen Namen für hdata und Variablen sind in der "Anleitung für API Erweiterung", Bereich "weechat_hdata_get". beschrieben
Examples (simple strings):
/eval -n ${raw:${info:version}} ==> ${info:version}
/eval -n ${eval_cond:${window.win_width}>100} ==> 1
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3
/eval -n ${sec.data.password} ==> secret
/eval -n ${window} ==> 0x2549aa0
/eval -n ${window.buffer} ==> 0x2549320
/eval -n ${window.buffer.full_name} ==> core.weechat
/eval -n ${window.buffer.number} ==> 1
/eval -n ${\t} ==> <tab>
/eval -n ${hide:-,${relay.network.password}} ==> --------
/eval -n ${cut:3,+,test} ==> tes+
/eval -n ${cut:+3,+,test} ==> te+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
/eval -n ${length:test} ==> 4
/eval -n ${split:1,,,abc,def,ghi} ==> abc
/eval -n ${split:-1,,,abc,def,ghi} ==> ghi
/eval -n ${split:count,,,abc,def,ghi} ==> 3
/eval -n ${split:random,,,abc,def,ghi} ==> def
/eval -n ${split_shell:1,"arg 1" arg2} ==> arg 1
/eval -n ${split_shell:-1,"arg 1" arg2} ==> arg2
/eval -n ${split_shell:count,"arg 1" arg2} ==> 2
/eval -n ${split_shell:random,"arg 1" arg2} ==> arg2
/eval -n ${calc:(5+2)*3} ==> 21
/eval -n ${random:0,10} ==> 3
/eval -n ${base_encode:64,test} ==> dGVzdA==
/eval -n ${base_decode:64,dGVzdA==} ==> test
/eval -n ${translate:Plugin} ==> Extension
Beispiele (einfache Zeichenketten):
/eval -n ${raw:${info:version}} ==> ${info:version}
/eval -n ${eval_cond:${window.win_width}>100} ==> 1
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3
/eval -n ${sec.data.password} ==> geheim
/eval -n ${window} ==> 0x2549aa0
/eval -n ${window.buffer} ==> 0x2549320
/eval -n ${window.buffer.full_name} ==> core.weechat
/eval -n ${window.buffer.number} ==> 1
/eval -n ${\t} ==> <tab>
/eval -n ${hide:-,${relay.network.password}} ==> --------
/eval -n ${cut:3,+,test} ==> tes+
/eval -n ${cut:+3,+,test} ==> te+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
/eval -n ${length:test} ==> 4
/eval -n ${split:1,,,abc,def,ghi} ==> abc
/eval -n ${split:-1,,,abc,def,ghi} ==> ghi
/eval -n ${split:count,,,abc,def,ghi} ==> 3
/eval -n ${split:random,,,abc,def,ghi} ==> def
/eval -n ${split_shell:1,"arg 1" arg2} ==> arg 1
/eval -n ${split_shell:-1,"arg 1" arg2} ==> arg2
/eval -n ${split_shell:count,"arg 1" arg2} ==> 2
/eval -n ${split_shell:random,"arg 1" arg2} ==> arg2
/eval -n ${calc:(5+2)*3} ==> 21
/eval -n ${random:0,10} ==> 3
/eval -n ${base_encode:64,test} ==> dGVzdA==
/eval -n ${base_decode:64,dGVzdA==} ==> test
/eval -n ${translate:Plugin} ==> Erweiterung
/eval -n ${define:len,${calc:5+3}}${len}x${len} ==> 8x8
Examples (conditions):
/eval -n -c ${window.buffer.number} > 2 ==> 0
/eval -n -c ${window.win_width} > 100 ==> 1
/eval -n -c (8 > 12) || (5 > 2) ==> 1
/eval -n -c (8 > 12) && (5 > 2) ==> 0
/eval -n -c abcd =~ ^ABC ==> 1
/eval -n -c abcd =~ (?-i)^ABC ==> 0
/eval -n -c abcd =~ (?-i)^abc ==> 1
/eval -n -c abcd !~ abc ==> 0
/eval -n -c abcd =* a*d ==> 1
/eval -n -c abcd =- bc ==> 1
Beispiele (Bedingungen):
/eval -n -c ${window.buffer.number} > 2 ==> 0
/eval -n -c ${window.win_width} > 100 ==> 1
/eval -n -c (8 > 12) || (5 > 2) ==> 1
/eval -n -c (8 > 12) && (5 > 2) ==> 0
/eval -n -c abcd =~ ^ABC ==> 1
/eval -n -c abcd =~ (?-i)^ABC ==> 0
/eval -n -c abcd =~ (?-i)^abc ==> 1
/eval -n -c abcd !~ abc ==> 0
/eval -n -c abcd =* a*d ==> 1
/eval -n -c abcd =- bc ==> 1
----
[[command_weechat_filter]]
@ -1993,6 +1993,32 @@ Beispiele:
/set env ABC ""
----
[[command_weechat_toggle]]
* `+toggle+`: toggle value of a config option
----
/toggle <option> [<value> [<value>...]]
option: name of an option
value: possible values for the option (values are split like the shell command arguments: quotes can be used to preserve spaces at the beginning/end of values)
Behavior:
- only an option of type boolean or string can be toggled without a value:
- boolean: toggle between on/off according to current value
- string: toggle between empty string and default value (works only if empty string is allowed for the option)
- with a single value given, toggle between this value and the default value of option
- with multiple values given, toggle between these values: the value used is the one following the current value of option; if the current value of option is not in list, the first value in the list is used
- the special value "null" can be given, but only as first value in the list and without quotes around.
Examples:
toggle display of time in chat area (without displaying the new value used):
/mute /toggle weechat.look.buffer_time_format
switch format of time in chat area (with seconds, without seconds, disabled):
/toggle weechat.look.buffer_time_format "%H:%M:%S" "%H:%M" ""
toggle autojoin of #weechat channel on libera server:
/toggle irc.server.libera.autojoin null #weechat
----
[[command_weechat_unset]]
* `+unset+`: Konfigurationsparameter freigeben/zurücksetzen

View File

@ -1993,6 +1993,32 @@ Examples:
/set env ABC ""
----
[[command_weechat_toggle]]
* `+toggle+`: toggle value of a config option
----
/toggle <option> [<value> [<value>...]]
option: name of an option
value: possible values for the option (values are split like the shell command arguments: quotes can be used to preserve spaces at the beginning/end of values)
Behavior:
- only an option of type boolean or string can be toggled without a value:
- boolean: toggle between on/off according to current value
- string: toggle between empty string and default value (works only if empty string is allowed for the option)
- with a single value given, toggle between this value and the default value of option
- with multiple values given, toggle between these values: the value used is the one following the current value of option; if the current value of option is not in list, the first value in the list is used
- the special value "null" can be given, but only as first value in the list and without quotes around.
Examples:
toggle display of time in chat area (without displaying the new value used):
/mute /toggle weechat.look.buffer_time_format
switch format of time in chat area (with seconds, without seconds, disabled):
/toggle weechat.look.buffer_time_format "%H:%M:%S" "%H:%M" ""
toggle autojoin of #weechat channel on libera server:
/toggle irc.server.libera.autojoin null #weechat
----
[[command_weechat_unset]]
* `+unset+`: unset/reset config options

View File

@ -403,6 +403,7 @@ WeeChat "core" is located in following directories:
|       core/ | Root of unit tests for core.
|          test-core-arraylist.cpp | Tests: arraylists.
|          test-core-calc.cpp | Tests: calculation of expressions.
|          test-core-config-file.cpp | Tests: configuration files.
|          test-core-crypto.cpp | Tests: cryptographic functions.
|          test-core-dir.cpp | Tests: directory/file functions.
|          test-core-eval.cpp | Tests: evaluation of expressions.

View File

@ -1993,6 +1993,32 @@ Exemples :
/set env ABC ""
----
[[command_weechat_toggle]]
* `+toggle+`: basculer la valeur d'une option de configuration
----
/toggle <option> [<valeur> [<valeur>...]]
option : nom d'une option
valeur : valeurs possibles pour l'option (les valeurs sont découpées comme le les paramètres d'une commande par le shell : des guillemets peuvent être utilisés pour préserver les espaces au début et à la fin des valeurs)
Comportement :
- seule une option de type booléen ou chaîne peut être basculée sans valeur :
- booléen : basculer on/off selon la valeur courante
- chaîne : basculer entre chaîne vide et la valeur par défaut (fonctionne seulement si une chaîne vide est autorisée pour l'option)
- avec une seule valeur donnée, basculer entre cette valeur et la valeur par défaut de l'option
- avec plusieurs valeurs données, basculer entre les valeurs : la valeur utilisée est celle qui suit la valeur courante de l'option ; si la valeur courante n'est pas dans la liste, la première valeur de la liste est utilisée
- la valeur spéciale "null" peut être donnée, mais seulement comme première valeur dans la liste et sans guillemets autour.
Exemples :
basculer l'affichage de l'heure dans la zone de discussion (sans afficher la nouvelle valeur utilisée) :
/mute /toggle weechat.look.buffer_time_format
basculer le format de l'heure dans la zone de discussion (avec secondes, sans secondes, désactivé) :
/toggle weechat.look.buffer_time_format "%H:%M:%S" "%H:%M" ""
basculer le "join" automatique du canal #weechat sur le serveur libera :
/toggle irc.server.libera.autojoin null #weechat
----
[[command_weechat_unset]]
* `+unset+`: supprimer/réinitialiser des options de configuration

View File

@ -405,6 +405,7 @@ Le cœur de WeeChat est situé dans les répertoires suivants :
|       core/ | Racine des tests unitaires pour le cœur.
|          test-core-arraylist.cpp | Tests : listes avec tableau (« arraylists »).
|          test-core-calc.cpp | Tests : calcul d'expressions.
|          test-core-config-file.cpp | Tests : fichiers de configuration.
|          test-core-crypto.cpp | Tests : fonctions cryptographiques.
|          test-core-dir.cpp | Tests : répertoires/fichiers.
|          test-core-eval.cpp | Tests : évaluation d'expressions.

View File

@ -1993,6 +1993,32 @@ Examples:
/set env ABC ""
----
[[command_weechat_toggle]]
* `+toggle+`: toggle value of a config option
----
/toggle <option> [<value> [<value>...]]
option: name of an option
value: possible values for the option (values are split like the shell command arguments: quotes can be used to preserve spaces at the beginning/end of values)
Behavior:
- only an option of type boolean or string can be toggled without a value:
- boolean: toggle between on/off according to current value
- string: toggle between empty string and default value (works only if empty string is allowed for the option)
- with a single value given, toggle between this value and the default value of option
- with multiple values given, toggle between these values: the value used is the one following the current value of option; if the current value of option is not in list, the first value in the list is used
- the special value "null" can be given, but only as first value in the list and without quotes around.
Examples:
toggle display of time in chat area (without displaying the new value used):
/mute /toggle weechat.look.buffer_time_format
switch format of time in chat area (with seconds, without seconds, disabled):
/toggle weechat.look.buffer_time_format "%H:%M:%S" "%H:%M" ""
toggle autojoin of #weechat channel on libera server:
/toggle irc.server.libera.autojoin null #weechat
----
[[command_weechat_unset]]
* `+unset+`: annulla/ripristina opzione

View File

@ -1993,6 +1993,32 @@ option: オプションの名前 (value を指定せずにワイルドカード
/set env ABC ""
----
[[command_weechat_toggle]]
* `+toggle+`: toggle value of a config option
----
/toggle <option> [<value> [<value>...]]
option: name of an option
value: possible values for the option (values are split like the shell command arguments: quotes can be used to preserve spaces at the beginning/end of values)
Behavior:
- only an option of type boolean or string can be toggled without a value:
- boolean: toggle between on/off according to current value
- string: toggle between empty string and default value (works only if empty string is allowed for the option)
- with a single value given, toggle between this value and the default value of option
- with multiple values given, toggle between these values: the value used is the one following the current value of option; if the current value of option is not in list, the first value in the list is used
- the special value "null" can be given, but only as first value in the list and without quotes around.
Examples:
toggle display of time in chat area (without displaying the new value used):
/mute /toggle weechat.look.buffer_time_format
switch format of time in chat area (with seconds, without seconds, disabled):
/toggle weechat.look.buffer_time_format "%H:%M:%S" "%H:%M" ""
toggle autojoin of #weechat channel on libera server:
/toggle irc.server.libera.autojoin null #weechat
----
[[command_weechat_unset]]
* `+unset+`: オプションのアンセット/リセット

View File

@ -424,6 +424,8 @@ WeeChat "core" は以下のディレクトリに配置されています:
// TRANSLATION MISSING
|          test-core-calc.cpp | Tests: calculation of expressions.
// TRANSLATION MISSING
|          test-core-config-file.cpp | Tests: configuration files.
// TRANSLATION MISSING
|          test-core-crypto.cpp | Tests: cryptographic functions.
// TRANSLATION MISSING
|          test-core-dir.cpp | Tests: directory/file functions.

View File

@ -1992,6 +1992,32 @@ Przykłady:
/set env ABC ""
----
[[command_weechat_toggle]]
* `+toggle+`: toggle value of a config option
----
/toggle <option> [<value> [<value>...]]
option: name of an option
value: possible values for the option (values are split like the shell command arguments: quotes can be used to preserve spaces at the beginning/end of values)
Behavior:
- only an option of type boolean or string can be toggled without a value:
- boolean: toggle between on/off according to current value
- string: toggle between empty string and default value (works only if empty string is allowed for the option)
- with a single value given, toggle between this value and the default value of option
- with multiple values given, toggle between these values: the value used is the one following the current value of option; if the current value of option is not in list, the first value in the list is used
- the special value "null" can be given, but only as first value in the list and without quotes around.
Examples:
toggle display of time in chat area (without displaying the new value used):
/mute /toggle weechat.look.buffer_time_format
switch format of time in chat area (with seconds, without seconds, disabled):
/toggle weechat.look.buffer_time_format "%H:%M:%S" "%H:%M" ""
toggle autojoin of #weechat channel on libera server:
/toggle irc.server.libera.autojoin null #weechat
----
[[command_weechat_unset]]
* `+unset+`: skasuj/zresetuj zmienną konfiguracyjną

View File

@ -1993,6 +1993,32 @@ passphrase: измена тајне реченице (без passphrase, под
/set env ABC ""
----
[[command_weechat_toggle]]
* `+toggle+`: toggle value of a config option
----
/toggle <option> [<value> [<value>...]]
option: name of an option
value: possible values for the option (values are split like the shell command arguments: quotes can be used to preserve spaces at the beginning/end of values)
Behavior:
- only an option of type boolean or string can be toggled without a value:
- boolean: toggle between on/off according to current value
- string: toggle between empty string and default value (works only if empty string is allowed for the option)
- with a single value given, toggle between this value and the default value of option
- with multiple values given, toggle between these values: the value used is the one following the current value of option; if the current value of option is not in list, the first value in the list is used
- the special value "null" can be given, but only as first value in the list and without quotes around.
Examples:
toggle display of time in chat area (without displaying the new value used):
/mute /toggle weechat.look.buffer_time_format
switch format of time in chat area (with seconds, without seconds, disabled):
/toggle weechat.look.buffer_time_format "%H:%M:%S" "%H:%M" ""
toggle autojoin of #weechat channel on libera server:
/toggle irc.server.libera.autojoin null #weechat
----
[[command_weechat_unset]]
* `+unset+`: уклањање/ресетовање конфиг опција

View File

@ -403,6 +403,8 @@ WeeChat „језгро” се налази у следећим директо
|       core/ | Корен unit тестова језгра.
|          test-core-arraylist.cpp | Тестови: arraylists.
|          test-core-calc.cpp | Тестови: калкулација израза.
// TRANSLATION MISSING
|          test-core-config-file.cpp | Tests: configuration files.
|          test-core-crypto.cpp | Тестови: криптографске функције.
|          test-core-dir.cpp | Тестови: функције директоријума/фајла.
|          test-core-eval.cpp | Тестови: израчунавање израза.

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-07-10 16:01+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2478,6 +2478,47 @@ msgstr ""
" nastaví slovo pro zvýrazňování:\n"
" /set weechat.look.highlight \"word\""
#, fuzzy
#| msgid "values for a configuration option"
msgid "toggle value of a config option"
msgstr "hodnoty pro konfigurační nastavení"
#, fuzzy
#| msgid "[<file> [<file>...]]"
msgid "<option> [<value> [<value>...]]"
msgstr "[<soubor> [<soubor>...]]"
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
msgid "unset/reset config options"
msgstr "odnastavit/resetovat konfigurační možnosti"

View File

@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-09-26 20:24+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@ -3160,6 +3160,47 @@ msgstr ""
" entfernt die Umgebungsvariable ABC:\n"
" /set env ABC \"\""
#, fuzzy
#| msgid "values for a configuration option"
msgid "toggle value of a config option"
msgstr "Werte für eine Konfigurationsoption"
#, fuzzy
#| msgid "[<file> [<file>...]]"
msgid "<option> [<value> [<value>...]]"
msgstr "[<file> [<file>...]]"
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
msgid "unset/reset config options"
msgstr "Konfigurationsparameter freigeben/zurücksetzen"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-07-10 16:01+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2584,6 +2584,47 @@ msgstr ""
" mostrar opciones cambiadas en el plugin irc:\n"
" /set diff irc.*"
#, fuzzy
#| msgid "values for a configuration option"
msgid "toggle value of a config option"
msgstr "valores de una opción de configuración"
#, fuzzy
#| msgid "[<file> [<file>...]]"
msgid "<option> [<value> [<value>...]]"
msgstr "[<archivo> [<archivo>...]]"
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
msgid "unset/reset config options"
msgstr "deshacer/reiniciar opciones de configuració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: 2021-09-20 21:12+0200\n"
"PO-Revision-Date: 2021-09-20 21:13+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-10-01 22:53+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -3086,6 +3086,73 @@ msgstr ""
" réinitialiser la variable d'environnement ABC :\n"
" /set env ABC \"\""
msgid "toggle value of a config option"
msgstr "basculer la valeur d'une option de configuration"
msgid "<option> [<value> [<value>...]]"
msgstr "<option> [<valeur> [<valeur>...]]"
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
"option : nom d'une option\n"
"valeur : valeurs possibles pour l'option (les valeurs sont découpées comme "
"le les paramètres d'une commande par le shell : des guillemets peuvent être "
"utilisés pour préserver les espaces au début et à la fin des valeurs)\n"
"\n"
"Comportement :\n"
" - seule une option de type booléen ou chaîne peut être basculée sans "
"valeur :\n"
" - booléen : basculer on/off selon la valeur courante\n"
" - chaîne : basculer entre chaîne vide et la valeur par défaut "
"(fonctionne seulement si une chaîne vide est autorisée pour l'option)\n"
" - avec une seule valeur donnée, basculer entre cette valeur et la valeur "
"par défaut de l'option\n"
" - avec plusieurs valeurs données, basculer entre les valeurs : la valeur "
"utilisée est celle qui suit la valeur courante de l'option ; si la valeur "
"courante n'est pas dans la liste, la première valeur de la liste est "
"utilisée\n"
" - la valeur spéciale \"null\" peut être donnée, mais seulement comme "
"première valeur dans la liste et sans guillemets autour.\n"
"\n"
"Exemples :\n"
" basculer l'affichage de l'heure dans la zone de discussion (sans afficher "
"la nouvelle valeur utilisée) :\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" basculer le format de l'heure dans la zone de discussion (avec secondes, "
"sans secondes, désactivé) :\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" basculer le \"join\" automatique du canal #weechat sur le serveur "
"libera :\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgid "unset/reset config options"
msgstr "supprimer/réinitialiser des options de configuration"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-07-10 16:01+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2259,6 +2259,44 @@ msgid ""
" /set env ABC \"\""
msgstr ""
#, fuzzy
msgid "toggle value of a config option"
msgstr "Nem található az opció\n"
msgid "<option> [<value> [<value>...]]"
msgstr ""
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
#, fuzzy
msgid "unset/reset config options"
msgstr "konfigurációs paraméterek beállítása"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-07-10 16:01+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2634,6 +2634,47 @@ msgstr ""
" mostra le opzioni modificate nel plugin irc:\n"
" /set diff irc.*"
#, fuzzy
#| msgid "values for a configuration option"
msgid "toggle value of a config option"
msgstr "valori per una opzione di configurazione"
#, fuzzy
#| msgid "[<file> [<file>...]]"
msgid "<option> [<value> [<value>...]]"
msgstr "[<file> [<file....>]]"
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
msgid "unset/reset config options"
msgstr "annulla/ripristina opzione"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-07-10 16:01+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@ -3027,6 +3027,47 @@ msgstr ""
" 環境変数 ABC の値を削除する:\n"
" /set env ABC \"\""
#, fuzzy
#| msgid "values for a configuration option"
msgid "toggle value of a config option"
msgstr "設定オプションの値"
#, fuzzy
#| msgid "[<file> [<file>...]]"
msgid "<option> [<value> [<value>...]]"
msgstr "[<file> [<file>...]]"
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
msgid "unset/reset config options"
msgstr "オプションのアンセット/リセット"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-07-10 16:01+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@ -3218,6 +3218,47 @@ msgstr ""
" kasuje zmienną środowiskową ABC:\n"
" /set env ABC \"\""
#, fuzzy
#| msgid "values for a configuration option"
msgid "toggle value of a config option"
msgstr "wartości opcji konfiguracyjnych"
#, fuzzy
#| msgid "[<file> [<file>...]]"
msgid "<option> [<value> [<value>...]]"
msgstr "[<plik> [<plik>...]]"
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
msgid "unset/reset config options"
msgstr "skasuj/zresetuj zmienną konfiguracyjną"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-07-10 16:01+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@ -3021,6 +3021,47 @@ msgstr ""
" não definir a variável de ambiente ABC:\n"
" /set env ABC \"\""
#, fuzzy
#| msgid "values for a configuration option"
msgid "toggle value of a config option"
msgstr "valores de uma opção de configuração"
#, fuzzy
#| msgid "[<file> [<file>...]]"
msgid "<option> [<value> [<value>...]]"
msgstr "[<ficheiro> [<ficheiro>...]]"
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
msgid "unset/reset config options"
msgstr "repor ou não definir opções de configuração"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-07-10 16:01+0200\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2694,6 +2694,47 @@ msgstr ""
" indefine a variável de ambiente ABC:\n"
" /set env ABC \"\""
#, fuzzy
#| msgid "values for a configuration option"
msgid "toggle value of a config option"
msgstr "valores para uma opção de configuração"
#, fuzzy
#| msgid "[<file> [<file>...]]"
msgid "<option> [<value> [<value>...]]"
msgstr "[<arquivo> [<arquivo>...]]"
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
msgid "unset/reset config options"
msgstr "indefine/restaura opções de configuração"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-07-10 16:01+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2283,6 +2283,44 @@ msgid ""
" /set env ABC \"\""
msgstr ""
#, fuzzy
msgid "toggle value of a config option"
msgstr "Не найден параметр\n"
msgid "<option> [<value> [<value>...]]"
msgstr ""
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
#, fuzzy
msgid "unset/reset config options"
msgstr "настроить параметры конфигурации"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-09-01 02:38+0400\n"
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3146,6 +3146,47 @@ msgstr ""
" уклања променљиву окружења ABC:\n"
" /set env ABC \"\""
#, fuzzy
#| msgid "values for a configuration option"
msgid "toggle value of a config option"
msgstr "вредности за опцију конфигурације"
#, fuzzy
#| msgid "[<file> [<file>...]]"
msgid "<option> [<value> [<value>...]]"
msgstr "[<фајл> [<фајл>...]]"
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
msgid "unset/reset config options"
msgstr "уклањање/ресетовање конфиг опција"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+0200\n"
"PO-Revision-Date: 2021-07-10 16:01+0200\n"
"Last-Translator: Emir SARI <bitigchi@me.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2557,6 +2557,47 @@ msgid ""
" /set env ABC \"\""
msgstr ""
#, fuzzy
#| msgid "values for a configuration option"
msgid "toggle value of a config option"
msgstr "bir yapılandırma seçeneğinin değerleri"
#, fuzzy
#| msgid "[<file> [<file>...]]"
msgid "<option> [<value> [<value>...]]"
msgstr "[<dosya> [<dosya>...]]"
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
msgid "unset/reset config options"
msgstr "yapılandırma seçeneklerini geri al/sıfırla"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-09-20 21:12+0200\n"
"POT-Creation-Date: 2021-10-01 22:52+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"
@ -2083,6 +2083,43 @@ msgid ""
" /set env ABC \"\""
msgstr ""
msgid "toggle value of a config option"
msgstr ""
msgid "<option> [<value> [<value>...]]"
msgstr ""
msgid ""
"option: name of an option\n"
" value: possible values for the option (values are split like the shell "
"command arguments: quotes can be used to preserve spaces at the beginning/"
"end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled without a "
"value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value (works only if "
"empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and the default "
"value of option\n"
" - with multiple values given, toggle between these values: the value used "
"is the one following the current value of option; if the current value of "
"option is not in list, the first value in the list is used\n"
" - the special value \"null\" can be given, but only as first value in the "
"list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the new value "
"used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without seconds, "
"disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" \"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"
msgstr ""
msgid "unset/reset config options"
msgstr ""

View File

@ -6302,6 +6302,78 @@ COMMAND_CALLBACK(set)
return WEECHAT_RC_OK;
}
/*
* Callback for command "/toggle": toggles value of configuration option.
*/
COMMAND_CALLBACK(toggle)
{
char **sargv;
int sargc, rc;
struct t_config_option *ptr_option;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) buffer;
COMMAND_MIN_ARGS(2, "");
config_file_search_with_string (argv[1], NULL, NULL, &ptr_option, NULL);
if (!ptr_option)
{
gui_chat_printf (NULL,
_("%sOption \"%s\" not found"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[1]);
return WEECHAT_RC_OK;
}
if ((ptr_option->type != CONFIG_OPTION_TYPE_BOOLEAN)
&& (ptr_option->type != CONFIG_OPTION_TYPE_STRING))
{
/* only boolean options can be toggled without a value */
COMMAND_MIN_ARGS(3, "");
}
if (argc > 2)
{
sargv = string_split_shell (argv_eol[2], &sargc);
if (!sargv)
COMMAND_ERROR;
if (string_strcasecmp (argv[2], WEECHAT_CONFIG_OPTION_NULL) == 0)
{
if (sargv[0])
free (sargv[0]);
sargv[0] = NULL;
}
}
else
{
sargv = NULL;
sargc = 0;
}
rc = config_file_option_toggle (ptr_option, (const char **)sargv, sargc, 1);
string_free_split (sargv);
switch (rc)
{
case WEECHAT_CONFIG_OPTION_SET_ERROR:
gui_chat_printf (NULL,
_("%sFailed to set option \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[1]);
return WEECHAT_RC_OK;
case WEECHAT_CONFIG_OPTION_SET_OK_CHANGED:
command_set_display_option (ptr_option, _("Option changed: "));
break;
default:
break;
}
return WEECHAT_RC_OK;
}
/*
* Unsets/resets one option.
*/
@ -8425,6 +8497,42 @@ command_init ()
" || diff %(config_options)|%*"
" || env %(env_vars) %(env_value)",
&command_set, NULL, NULL);
hook_command (
NULL, "toggle",
N_("toggle value of a config option"),
N_("<option> [<value> [<value>...]]"),
N_("option: name of an option\n"
" value: possible values for the option (values are split like the "
"shell command arguments: quotes can be used to preserve spaces at "
"the beginning/end of values)\n"
"\n"
"Behavior:\n"
" - only an option of type boolean or string can be toggled "
"without a value:\n"
" - boolean: toggle between on/off according to current value\n"
" - string: toggle between empty string and default value "
"(works only if empty string is allowed for the option)\n"
" - with a single value given, toggle between this value and "
"the default value of option\n"
" - with multiple values given, toggle between these values: "
"the value used is the one following the current value of option; "
"if the current value of option is not in list, the first value in "
"the list is used\n"
" - the special value \"null\" can be given, but only as first "
"value in the list and without quotes around.\n"
"\n"
"Examples:\n"
" toggle display of time in chat area (without displaying the "
"new value used):\n"
" /mute /toggle weechat.look.buffer_time_format\n"
" switch format of time in chat area (with seconds, without "
"seconds, disabled):\n"
" /toggle weechat.look.buffer_time_format \"%H:%M:%S\" "
"\"%H:%M\" \"\"\n"
" toggle autojoin of #weechat channel on libera server:\n"
" /toggle irc.server.libera.autojoin null #weechat"),
"%(config_options) %(config_option_values)",
&command_toggle, NULL, NULL);
hook_command (
NULL, "unset",
N_("unset/reset config options"),

View File

@ -1520,6 +1520,110 @@ config_file_option_set (struct t_config_option *option, const char *value,
return rc;
}
/*
* Toggles value of an option.
*
* Returns:
* WEECHAT_CONFIG_OPTION_SET_OK_CHANGED: OK, value has been changed
* WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE: OK, value not changed
* WEECHAT_CONFIG_OPTION_SET_ERROR: error
*/
int
config_file_option_toggle (struct t_config_option *option,
const char **values, int num_values,
int run_callback)
{
char *current_value;
const char *ptr_new_value, *empty_string = "";
int i, rc, index_found, value_is_null, reset_value;
if (!option || (num_values < 0))
return WEECHAT_CONFIG_OPTION_SET_ERROR;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
ptr_new_value = NULL;
reset_value = 0;
value_is_null = (option->value == NULL);
current_value = config_file_option_value_to_string (option, 0, 0, 0);
switch (option->type)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
if (!values)
{
ptr_new_value = (option->value && CONFIG_BOOLEAN(option)) ?
config_boolean_false[0] : config_boolean_true[0];
}
break;
case CONFIG_OPTION_TYPE_INTEGER:
if (!values)
goto end;
break;
case CONFIG_OPTION_TYPE_STRING:
if (!values)
{
if (option->value && (strcmp (CONFIG_STRING(option), "") == 0))
ptr_new_value = CONFIG_STRING_DEFAULT(option);
else
ptr_new_value = empty_string;
}
break;
case CONFIG_OPTION_TYPE_COLOR:
if (!values)
goto end;
break;
case CONFIG_NUM_OPTION_TYPES:
/* make C compiler happy */
break;
}
/* search new value to use with the provided list of values */
if (!ptr_new_value && values)
{
index_found = -1;
for (i = 0; i < num_values; i++)
{
if ((value_is_null && !values[i])
|| (!value_is_null && current_value && values[i]
&& strcmp (current_value, values[i]) == 0))
{
index_found = i;
break;
}
}
if (index_found >= 0)
{
if (index_found + 1 < num_values)
{
ptr_new_value = values[index_found + 1];
}
else
{
if (num_values < 2)
reset_value = 1;
else
ptr_new_value = values[0];
}
}
else
{
ptr_new_value = values[0];
}
}
if (reset_value)
rc = config_file_option_reset (option, run_callback);
else
rc = config_file_option_set (option, ptr_new_value, run_callback);
end:
if (current_value)
free (current_value);
return rc;
}
/*
* Sets null (undefined) value for an option.
*

View File

@ -259,6 +259,9 @@ extern int config_file_option_set (struct t_config_option *option,
const char *value, int run_callback);
extern int config_file_option_set_null (struct t_config_option *option,
int run_callback);
extern int config_file_option_toggle (struct t_config_option *option,
const char **values, int num_values,
int run_callback);
extern int config_file_option_unset (struct t_config_option *option);
extern void config_file_option_rename (struct t_config_option *option,
const char *new_name);

View File

@ -26,6 +26,7 @@ include_directories(${CPPUTEST_INCLUDE_DIRS} ${PROJECT_BINARY_DIR} ${PROJECT_SOU
set(LIB_WEECHAT_UNIT_TESTS_CORE_SRC
unit/core/test-core-arraylist.cpp
unit/core/test-core-calc.cpp
unit/core/test-core-config-file.cpp
unit/core/test-core-crypto.cpp
unit/core/test-core-dir.cpp
unit/core/test-core-eval.cpp

View File

@ -23,6 +23,7 @@ noinst_LIBRARIES = lib_weechat_unit_tests_core.a
lib_weechat_unit_tests_core_a_SOURCES = unit/core/test-core-arraylist.cpp \
unit/core/test-core-calc.cpp \
unit/core/test-core-config-file.cpp \
unit/core/test-core-crypto.cpp \
unit/core/test-core-dir.cpp \
unit/core/test-core-eval.cpp \

View File

@ -61,6 +61,7 @@ extern "C"
/* core */
IMPORT_TEST_GROUP(CoreArraylist);
IMPORT_TEST_GROUP(CoreCalc);
IMPORT_TEST_GROUP(CoreConfigFile);
IMPORT_TEST_GROUP(CoreCrypto);
IMPORT_TEST_GROUP(CoreDir);
IMPORT_TEST_GROUP(CoreEval);

File diff suppressed because it is too large Load Diff