1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

fset: add option -import in command /fset

This commit is contained in:
Sébastien Helleu
2024-03-25 21:00:42 +01:00
parent 8482e14630
commit 26630ada2d
18 changed files with 204 additions and 30 deletions
+1
View File
@@ -36,6 +36,7 @@ New features::
* api: add info "plugin_loaded"
* api: add support of specifier `%!` for timestamp in function util_strftimeval
* api: add support of base64url in encode/decode functions
* fset: add option `-import` in command `/fset`
* irc: add option `-all` in command `/allchan`, do not execute command on parted channels by default (issue #2085)
* irc: add server option "autojoin_delay" (delay before autojoin), use option "command_delay" before execution of the command (issue #862)
* relay: add "api" protocol (HTTP REST API), add option relay.look.display_clients, change option type relay.look.auto_open_buffer to string, rename option relay.weechat.commands to relay.network.commands, add option relay.network.time_window (issue #2066)
+7 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2024-03-06 20:32+0100\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7403,7 +7403,7 @@ msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
msgid "raw[-bar]: add the help bar"
@@ -7472,6 +7472,11 @@ msgid ""
"has format: \"/set name value\" or \"/unset name\")"
msgstr ""
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+13 -2
View File
@@ -26,7 +26,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2024-03-25 11:43+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@@ -8497,11 +8497,17 @@ msgid "fast set WeeChat and plugins options"
msgstr "Optionen von WeeChat und Erweiterungen schnell anpassen"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated
#, fuzzy
#| msgid ""
#| "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -"
#| "go <line>|end || -toggle || -add [<value>] || -reset || -unset || -set || "
#| "-setnew || -append || -mark || -format || -export [-help|-nohelp] "
#| "<filename> || <filter>"
msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
@@ -8599,6 +8605,11 @@ msgstr ""
"eine Datei (jede Zeile hat das Format: \"/set Name Wert\" oder \"/unset "
"Name\")"
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+7 -2
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2024-03-06 20:32+0100\n"
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7584,7 +7584,7 @@ msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
msgid "raw[-bar]: add the help bar"
@@ -7653,6 +7653,11 @@ msgid ""
"has format: \"/set name value\" or \"/unset name\")"
msgstr ""
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+11 -4
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"PO-Revision-Date: 2024-03-25 12:06+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2024-03-25 21:00+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -8336,12 +8336,12 @@ msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
"-bar || -refresh || -up|-down [<nombre>] || -left|-right [<pourcentage>] || -"
"go <ligne>|end || -toggle || -add [<valeur>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <fichier> "
"|| <filtre>"
"|| -import <fichier> || <filtre>"
msgid "raw[-bar]: add the help bar"
msgstr "raw[-bar] : ajouter la barre d'aide"
@@ -8432,6 +8432,13 @@ msgstr ""
"raw[-export] : exporter les options et valeurs affichées dans un fichier "
"(chaque ligne a le format : \"/set nom valeur\" ou \"/unset nom\")"
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
"raw[-import] : importer les options depuis un fichier (toutes les lignes qui "
"contiennent des commandes sont exécutées)"
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+7 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2023-11-29 09:59+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7068,7 +7068,7 @@ msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
msgid "raw[-bar]: add the help bar"
@@ -7137,6 +7137,11 @@ msgid ""
"has format: \"/set name value\" or \"/unset name\")"
msgstr ""
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+7 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2024-03-06 20:32+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7576,7 +7576,7 @@ msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
msgid "raw[-bar]: add the help bar"
@@ -7645,6 +7645,11 @@ msgid ""
"has format: \"/set name value\" or \"/unset name\")"
msgstr ""
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+13 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2024-03-06 20:32+0100\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -7825,11 +7825,17 @@ msgid "fast set WeeChat and plugins options"
msgstr "WeeChat とプラグインのオプションを高速設定"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated
#, fuzzy
#| msgid ""
#| "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -"
#| "go <line>|end || -toggle || -add [<value>] || -reset || -unset || -set || "
#| "-setnew || -append || -mark || -format || -export [-help|-nohelp] "
#| "<filename> || <filter>"
msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
@@ -7906,6 +7912,11 @@ msgid ""
"has format: \"/set name value\" or \"/unset name\")"
msgstr ""
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+13 -2
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2024-03-06 20:32+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8081,11 +8081,17 @@ msgid "fast set WeeChat and plugins options"
msgstr "szybkie ustawianie opcji WeeChat i wtyczek"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated
#, fuzzy
#| msgid ""
#| "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -"
#| "go <line>|end || -toggle || -add [<value>] || -reset || -unset || -set || "
#| "-setnew || -append || -mark || -format || -export [-help|-nohelp] "
#| "<filename> || <filter>"
msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
"-bar || -refresh || -up|-down [<ilość>] || -left|-right [<procent>] || -go "
"<linia>|end || -toggle || -add [<wartość>] || -reset || -unset || -set || -"
@@ -8173,6 +8179,11 @@ msgstr ""
"raw[-export]: wyeksportuj opcje i wartości wyświetlane w pliku (każda linia "
"ma format: „/set nazwa wartość” lub „/unset nazwa”)"
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+7 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2024-03-06 20:32+0100\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@@ -7816,7 +7816,7 @@ msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
msgid "raw[-bar]: add the help bar"
@@ -7885,6 +7885,11 @@ msgid ""
"has format: \"/set name value\" or \"/unset name\")"
msgstr ""
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+7 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2024-02-17 10:07+0100\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7478,7 +7478,7 @@ msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
msgid "raw[-bar]: add the help bar"
@@ -7547,6 +7547,11 @@ msgid ""
"has format: \"/set name value\" or \"/unset name\")"
msgstr ""
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+7 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2023-11-29 09:59+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7109,7 +7109,7 @@ msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
msgid "raw[-bar]: add the help bar"
@@ -7178,6 +7178,11 @@ msgid ""
"has format: \"/set name value\" or \"/unset name\")"
msgstr ""
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+13 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2024-03-06 20:32+0100\n"
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8107,11 +8107,17 @@ msgid "fast set WeeChat and plugins options"
msgstr "брзо постављање опција за програм WeeChat и додатке"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated
#, fuzzy
#| msgid ""
#| "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -"
#| "go <line>|end || -toggle || -add [<value>] || -reset || -unset || -set || "
#| "-setnew || -append || -mark || -format || -export [-help|-nohelp] "
#| "<filename> || <filter>"
msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
"-bar || -refresh || -up|-down [<број>] || -left|-right [<проценат>] || -go "
"<линија>|end || -toggle || -add [<вредн>] || -reset || -unset || -set || -"
@@ -8199,6 +8205,11 @@ msgstr ""
"raw[-export]: извоз опција и вредности које су приказане у фајлу (свака "
"линија има формат: „/set име вредност” или „/unset име”)"
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+13 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\n"
"PO-Revision-Date: 2024-03-06 20:33+0100\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7911,11 +7911,17 @@ msgid "fast set WeeChat and plugins options"
msgstr "WeeChat ve eklenti seçeneklerini hızlıca ayarla"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated
#, fuzzy
#| msgid ""
#| "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -"
#| "go <line>|end || -toggle || -add [<value>] || -reset || -unset || -set || "
#| "-setnew || -append || -mark || -format || -export [-help|-nohelp] "
#| "<filename> || <filter>"
msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
"-bar || -refresh || -up|-down [<sayı>] || -left|-right [<yüzde>] || -go "
"<satır>|end || -toggle || -add [<değer>] || -reset || -unset || -set || -"
@@ -7992,6 +7998,11 @@ msgid ""
"has format: \"/set name value\" or \"/unset name\")"
msgstr ""
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+7 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-03-25 12:05+0100\n"
"POT-Creation-Date: 2024-03-25 20:59+0100\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"
@@ -6612,7 +6612,7 @@ msgid ""
"-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go "
"<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -"
"setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> "
"|| <filter>"
"|| -import <filename> || <filter>"
msgstr ""
msgid "raw[-bar]: add the help bar"
@@ -6681,6 +6681,11 @@ msgid ""
"has format: \"/set name value\" or \"/unset name\")"
msgstr ""
msgid ""
"raw[-import]: import the options from a file (all lines containing commands "
"are are executed)"
msgstr ""
msgid ""
"raw[-help]: force writing of help on options in exported file (see /help "
"fset.look.export_help_default)"
+13
View File
@@ -423,6 +423,15 @@ fset_command_fset (const void *pointer, void *data,
return WEECHAT_RC_OK;
}
if (weechat_strcmp (argv[1], "-import") == 0)
{
if (argc < 3)
WEECHAT_COMMAND_ERROR;
if (!fset_option_import (argv_eol[2]))
WEECHAT_COMMAND_ERROR;
return WEECHAT_RC_OK;
}
WEECHAT_COMMAND_ERROR;
}
else
@@ -639,6 +648,7 @@ fset_command_init ()
" || -mark"
" || -format"
" || -export [-help|-nohelp] <filename>"
" || -import <filename>"
" || <filter>"),
WEECHAT_CMD_ARGS_DESC(
N_("raw[-bar]: add the help bar"),
@@ -666,6 +676,8 @@ fset_command_init ()
N_("raw[-format]: switch to the next available format"),
N_("raw[-export]: export the options and values displayed in a file "
"(each line has format: \"/set name value\" or \"/unset name\")"),
N_("raw[-import]: import the options from a file "
"(all lines containing commands are are executed)"),
N_("raw[-help]: force writing of help on options in exported file "
"(see /help fset.look.export_help_default)"),
N_("raw[-nohelp]: do not write help on options in exported file "
@@ -784,6 +796,7 @@ fset_command_init ()
" || -mark"
" || -format"
" || -export -help|-nohelp|%(filename) %(filename)"
" || -import %(filename)"
" || *|c:|f:|s:|d|d:|d=|d==|=|==|%(fset_options)",
&fset_command_fset, NULL, NULL);
weechat_hook_command_run ("/set", &fset_command_run_set_cb, NULL, NULL);
+57
View File
@@ -1470,6 +1470,63 @@ fset_option_export (const char *filename, int with_help)
return 1;
}
/*
* Imports options from a file: all lines starting with "/" are executed.
*
* Returns:
* 1: export OK
* 0: error
*/
int
fset_option_import (const char *filename)
{
char *filename2, line[4096], *ptr_line;
FILE *file;
int length;
filename2 = weechat_string_expand_home (filename);
if (!filename2)
return 0;
file = fopen (filename2, "r");
if (!file)
{
free (filename2);
return 0;
}
while (!feof (file))
{
ptr_line = fgets (line, sizeof (line) - 1, file);
if (!ptr_line)
continue;
/* ignore comments */
if (ptr_line[0] == '#')
continue;
/* execute command (if it's a valid command) */
if (!weechat_string_input_for_buffer (ptr_line))
{
/* remove trailing '\r' and '\n' */
length = strlen (line) - 1;
while ((length >= 0)
&& ((line[length] == '\n')
|| (line[length] == '\r')))
{
line[length] = '\0';
length--;
}
weechat_command (NULL, ptr_line);
}
}
fclose (file);
free (filename2);
return 1;
}
/*
* Refreshes the fset buffer after the change of an option.
*/
+1
View File
@@ -121,6 +121,7 @@ extern void fset_option_mark_options_matching_filter (const char *filter,
int mark);
extern void fset_option_unmark_all ();
extern int fset_option_export (const char *filename, int with_help);
extern int fset_option_import (const char *filename);
extern int fset_option_config_cb (const void *pointer,
void *data,
const char *option,