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

core: add option "diff" for command /set (list options with changed value)

This commit is contained in:
Peter Boström
2012-12-20 18:18:33 +01:00
committed by Sebastien Helleu
parent 0e726b43ef
commit a67d97f16e
20 changed files with 655 additions and 758 deletions
+2 -1
View File
@@ -1,12 +1,13 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.0-dev, 2012-12-19
v0.4.0-dev, 2012-12-20
Version 0.4.0 (under dev!)
--------------------------
* core: add option "diff" for command /set (list options with changed value)
* core: fix refresh of windows after split (fix bug with horizontal separator
between windows) (bug #37874)
* core: fix stuck mouse (bug #36533)
+17 -11
View File
@@ -605,23 +605,29 @@ Wird keine Datei angegeben dann werden alle Konfigurationen (WeeChat und Erweite
[command]*`set`* Konfigurationsparameter setzen::
........................................
/set [<option> [<value>]]
diff [<option> [<option>...]]
option: Name der zu ändernden Option (darf mit einem Joker '*' beginnen oder enden um mehrere Optionen anzuzeigen)
value: neuer Wert, den die Option erhalten soll
option: name of an option (can start or end with '*' to list many options)
value: new value for option
diff: display only changed options
Abhängig von der ausgewählten Option, kann die Variable folgenden Inhalt haben:
boolean: on, off oder toggle
integer: Anzahl, ++Anzahl oder --Anzahl
string : jede Zeichenkette ("" für eine leere Zeichenkette)
color : Name einer Farbe, ++Anzahl oder --Anzahl
New value can be, according to variable type:
boolean: on, off or toggle
integer: number, ++number or --number
string: any string ("" for empty string)
color: color name, ++number or --number
Für alle Typen von Variablen kann die Zeichenkette "null" (ohne "") genutzt werden um den Wert der Option zu löschen (undefinierter Wert). Dies kann nur bei einigen Erweiterungen genutzt werden.
For all types, you can use null to remove option value (undefined value). This works only for some special plugin variables.
Beispiele:
Zeigt alle Optionen an die etwas mit highlight zu tun haben:
Examples:
display options about highlight:
/set *highlight*
Fügt ein highlight-Wort hinzu:
add a word to highlight:
/set weechat.look.highlight "word"
display changed options:
/set diff
display changed options in irc plugin:
/set diff irc.*
........................................
[[command_weechat_unset]]
+8 -2
View File
@@ -605,15 +605,17 @@ Without argument, all files (WeeChat and plugins) are saved.
[command]*`set`* set config options::
........................................
/set [<option> [<value>]]
diff [<option> [<option>...]]
option: name of an option (can start or end with '*' to list many options)
value: new value for option
diff: display only changed options
New value can be, according to variable type:
boolean: on, off or toggle
integer: number, ++number or --number
string : any string ("" for empty string)
color : color name, ++number or --number
string: any string ("" for empty string)
color: color name, ++number or --number
For all types, you can use null to remove option value (undefined value). This works only for some special plugin variables.
@@ -622,6 +624,10 @@ Examples:
/set *highlight*
add a word to highlight:
/set weechat.look.highlight "word"
display changed options:
/set diff
display changed options in irc plugin:
/set diff irc.*
........................................
[[command_weechat_unset]]
+8 -2
View File
@@ -605,14 +605,16 @@ Sans paramètre, tous les fichiers (WeeChat et extensions) sont sauvegardés.
[command]*`set`* modifier des options de configuration::
........................................
/set [<option> [<valeur>]]
diff [<option> [<option>...]]
option: nom d'une option (peut démarrer ou se terminer par '*' pour lister plusieurs options)
valeur: nouvelle valeur pour l'option
diff: afficher seulement les options modifiées
La nouvelle valeur peut être, selon le type de l'option:
booléen: on, off ou toggle
entier : nombre, ++nombre ou --nombre
chaîne : toute chaîne ("" pour une chaîne vide)
entier: nombre, ++nombre ou --nombre
chaîne: toute chaîne ("" pour une chaîne vide)
couleur: nom de couleur, ++nombre ou --nombre
Pour tous les types, vous pouvez utiliser null pour supprimer la valeur de l'option (valeur non définie). Cela ne fonctionne qu'avec certaines options spéciales des extensions.
@@ -622,6 +624,10 @@ Exemples:
/set *highlight*
ajouter un mot pour le highlight:
/set weechat.look.highlight "mot"
afficher les options modifiées:
/set diff
afficher les options modifiées dans l'extension irc:
/set diff irc.*
........................................
[[command_weechat_unset]]
+18 -12
View File
@@ -604,24 +604,30 @@ Senza argomento, vengono salvati tutti i file (WeeChat e plugin).
[[command_weechat_set]]
[command]*`set`* imposta le opzioni di configurazione::
........................................
/set [<opzione> [<valore>]]
/set [<option> [<value>]]
diff [<option> [<option>...]]
opzione: nome di un'opzione (può iniziare o terminare con '*' per elencare più opzioni)
valore: nuovo valore per l'opzione
option: name of an option (can start or end with '*' to list many options)
value: new value for option
diff: display only changed options
Il nuovo valore può essere, a seconda del tipo di variabile:
booleano: on, off o toggle
intero : numero, ++numero o --numero
stringa : qualsiasi stringa ("" per una stringa vuota)
colore : nome colore, ++numeero o --numero
New value can be, according to variable type:
boolean: on, off or toggle
integer: number, ++number or --number
string: any string ("" for empty string)
color: color name, ++number or --number
Per tutti i tipi, è possibile usare null per rimuovere il valore dell'opzione (valore non definito). Ciò funziona solo per alcune variabili speciali dei plugin.
For all types, you can use null to remove option value (undefined value). This works only for some special plugin variables.
Esempi:
mostra le opzioni relative alle notifiche:
Examples:
display options about highlight:
/set *highlight*
aggiunge una parola alle notifiche:
add a word to highlight:
/set weechat.look.highlight "word"
display changed options:
/set diff
display changed options in irc plugin:
/set diff irc.*
........................................
[[command_weechat_unset]]
+17 -11
View File
@@ -605,23 +605,29 @@ file: 保存する設定ファイル (拡張子 ".conf" は不要)
[command]*`set`* オプションの設定::
........................................
/set [<option> [<value>]]
diff [<option> [<option>...]]
option: オプションの名前 (多くのオプションをリストアップするには、'*' で始めるか終わるかしてください)
value: オプションに対する新しい値
option: name of an option (can start or end with '*' to list many options)
value: new value for option
diff: display only changed options
新しいオプションは以下の変数型に従います:
boolean: onofftoggle
integer: 番号、++番号、--番号
string : 任意の文字列 (空文字列は "")
color : 色の名前、++色番号、--色番号
New value can be, according to variable type:
boolean: on, off or toggle
integer: number, ++number or --number
string: any string ("" for empty string)
color: color name, ++number or --number
どんな型であっても、オプションの値を削除する (未定義値にする) には null が使えます。これはいくつかの特別なプラグイン変数でのみ有効です。
For all types, you can use null to remove option value (undefined value). This works only for some special plugin variables.
:
ハイライトに関するオプションを表示:
Examples:
display options about highlight:
/set *highlight*
highlight に単語を追加:
add a word to highlight:
/set weechat.look.highlight "word"
display changed options:
/set diff
display changed options in irc plugin:
/set diff irc.*
........................................
[[command_weechat_unset]]
+39 -57
View File
File diff suppressed because it is too large Load Diff
+37 -134
View File
File diff suppressed because it is too large Load Diff
+37 -69
View File
File diff suppressed because it is too large Load Diff
+44 -40
View File
File diff suppressed because it is too large Load Diff
+31 -53
View File
File diff suppressed because it is too large Load Diff
+37 -66
View File
File diff suppressed because it is too large Load Diff
+36 -69
View File
File diff suppressed because it is too large Load Diff
+40 -66
View File
File diff suppressed because it is too large Load Diff
+37 -62
View File
File diff suppressed because it is too large Load Diff
+33 -53
View File
File diff suppressed because it is too large Load Diff
+28 -11
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-12-16 19:14+0100\n"
"POT-Creation-Date: 2012-12-20 17:20+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -647,18 +647,30 @@ msgid ""
"option to see a sublist)"
msgstr ""
msgid "No configuration option found"
msgid "No option found"
msgstr ""
#, c-format
msgid "%s%d%s configuration option found matching with \"%s\""
msgid_plural "%s%d%s configuration options found matching with \"%s\""
msgid "%s%d%s option with value changed (matching with \"%s\")"
msgid_plural "%s%d%s options with value changed (matching with \"%s\")"
msgstr[0] ""
msgstr[1] ""
#, c-format
msgid "%s%d%s configuration option found"
msgid_plural "%s%d%s configuration options found"
msgid "%s%d%s option (matching with \"%s\")"
msgid_plural "%s%d%s options (matching with \"%s\")"
msgstr[0] ""
msgstr[1] ""
#, c-format
msgid "%s%d%s option"
msgid_plural "%s%d%s options"
msgstr[0] ""
msgstr[1] ""
#, c-format
msgid "%s%d%s option with value changed"
msgid_plural "%s%d%s options with value changed"
msgstr[0] ""
msgstr[1] ""
@@ -667,7 +679,7 @@ msgid "%sError: failed to set option \"%s\""
msgstr ""
#, c-format
msgid "%sError: configuration option \"%s\" not found"
msgid "%sError: option \"%s\" not found"
msgstr ""
msgid "Option changed: "
@@ -1456,18 +1468,19 @@ msgstr ""
msgid "set config options"
msgstr ""
msgid "[<option> [<value>]]"
msgid "[<option> [<value>]] || diff [<option> [<option>...]]"
msgstr ""
msgid ""
"option: name of an option (can start or end with '*' to list many options)\n"
" value: new value for option\n"
" diff: display only changed options\n"
"\n"
"New value can be, according to variable type:\n"
" boolean: on, off or toggle\n"
" integer: number, ++number or --number\n"
" string : any string (\"\" for empty string)\n"
" color : color name, ++number or --number\n"
" string: any string (\"\" for empty string)\n"
" color: color name, ++number or --number\n"
"\n"
"For all types, you can use null to remove option value (undefined value). "
"This works only for some special plugin variables.\n"
@@ -1476,7 +1489,11 @@ msgid ""
" display options about highlight:\n"
" /set *highlight*\n"
" add a word to highlight:\n"
" /set weechat.look.highlight \"word\""
" /set weechat.look.highlight \"word\"\n"
" display changed options:\n"
" /set diff\n"
" display changed options in irc plugin:\n"
" /set diff irc.*"
msgstr ""
msgid "unset/reset config options"
+144 -39
View File
File diff suppressed because it is too large Load Diff
+41
View File
@@ -1605,6 +1605,47 @@ config_file_option_default_is_null (struct t_config_option *option)
return (option->default_value) ? 0 : 1;
}
/*
* Checks if an option has changed (current value different from default value).
*
* Returns:
* 1: option has changed
* 0: option has default value
*/
int config_file_option_has_changed (struct t_config_option *option)
{
/* both default and current value are null => not changed */
if (!option->default_value && !option->value)
return 0;
/* default is null and current value is not null => changed! */
if (!option->default_value && option->value)
return 1;
/* default is not null and current value is null => changed! */
if (option->default_value && !option->value)
return 1;
/* both default and current value are not null, compare their values */
switch (option->type)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
return CONFIG_BOOLEAN(option) != CONFIG_BOOLEAN_DEFAULT(option);
case CONFIG_OPTION_TYPE_INTEGER:
return CONFIG_INTEGER(option) != CONFIG_INTEGER_DEFAULT(option);
case CONFIG_OPTION_TYPE_STRING:
return strcmp(CONFIG_STRING(option), CONFIG_STRING_DEFAULT(option)) != 0;
case CONFIG_OPTION_TYPE_COLOR:
return CONFIG_COLOR(option) != CONFIG_COLOR_DEFAULT(option);
case CONFIG_NUM_OPTION_TYPES:
/* make C compiler happy */
break;
}
return 0;
}
/*
* Sets the value for an option using a full name of option (format:
* "file.section.option").
+1
View File
@@ -226,6 +226,7 @@ extern void *config_file_option_get_pointer (struct t_config_option *option,
const char *property);
extern int config_file_option_is_null (struct t_config_option *option);
extern int config_file_option_default_is_null (struct t_config_option *option);
extern int config_file_option_has_changed (struct t_config_option *option);
extern int config_file_option_set_with_string (const char *option_name, const char *value);
extern int config_file_option_boolean (struct t_config_option *option);
extern int config_file_option_boolean_default (struct t_config_option *option);