recoll: fix generation of string lists

The updated implementation will quote string lists as per the
description at

  https://www.lesbonscomptes.com/recoll/usermanual/#RCL.INSTALL.CONFIG

Fixes #3732
This commit is contained in:
Robert Helgesson 2023-03-02 19:22:24 +01:00
parent 547a3bc8d4
commit b9e3a29864
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 21 additions and 17 deletions

View file

@ -10,15 +10,16 @@ let
# see the example configuration from the package (i.e., # see the example configuration from the package (i.e.,
# `$out/share/recoll/examples/recoll.conf`). # `$out/share/recoll/examples/recoll.conf`).
mkRecollConfKeyValue = generators.mkKeyValueDefault { mkRecollConfKeyValue = generators.mkKeyValueDefault {
mkValueString = v: mkValueString = let mkQuoted = v: ''"${escape [ ''"'' ] v}"'';
if v == true then in v:
"1" if v == true then
else if v == false then "1"
"0" else if v == false then
else if isList v then "0"
concatStringsSep " " v else if isList v then
else concatMapStringsSep " " mkQuoted v
generators.mkValueStringDefault { } v; else
generators.mkValueStringDefault { } v;
} " = "; } " = ";
# A modified version of 'lib.generators.toINI' that also accepts top-level # A modified version of 'lib.generators.toINI' that also accepts top-level

View file

@ -1,16 +1,18 @@
dbdir = ~/.cache/recoll/xapiandb
nocjk = 0 nocjk = 0
skippedNames+ = node_modules skippedNames+ = "node_modules"
topdirs = ~/Downloads ~/Documents ~/library topdirs = "~/Downloads" "~/Documents" "~/library" "~/\"cool\" files"
underscoresasletter = 1 underscoresasletter = 1
[~/library/projects] [~/library/projects]
skippedNames+ = .editorconfig .gitignore result flake.lock go.sum skippedNames+ = ".editorconfig" ".gitignore" "result" "flake.lock" "go.sum"
[~/library/projects/software] [~/library/projects/software]
skippedNames+ = target result skippedNames+ = "target" "result"
[~/what-is-this-project] [~/what-is-this-project]
skippedNames+ = whoa-there skippedNames+ = "whoa-there"

View file

@ -6,7 +6,8 @@
package = config.lib.test.mkStubPackage { }; package = config.lib.test.mkStubPackage { };
configDir = "${config.xdg.configHome}/recoll"; configDir = "${config.xdg.configHome}/recoll";
settings = { settings = {
topdirs = [ "~/Downloads" "~/Documents" "~/library" ]; dbdir = "~/.cache/recoll/xapiandb";
topdirs = [ "~/Downloads" "~/Documents" "~/library" ''~/"cool" files'' ];
"skippedNames+" = [ "node_modules" ]; "skippedNames+" = [ "node_modules" ];
underscoresasletter = true; underscoresasletter = true;
nocjk = false; nocjk = false;

View file

@ -4,7 +4,7 @@ d = 0
e = This should be the second to the last non-attrset value in the config. e = This should be the second to the last non-attrset value in the config.
g = This is coming from a list g = "This" "is" "coming" "from" "a" "list"
[a] [a]
foo = bar foo = bar
@ -18,7 +18,7 @@ b = 53
a = This should be second to the last for the attribute names with an attrset. a = This should be second to the last for the attribute names with an attrset.
b = 3193 b = 3193
c = 0 c = 0
d = Hello there d = "Hello" "there"
[foo] [foo]
bar = This should be the last attribute with an attrset. bar = This should be the last attribute with an attrset.