concatStringsSep "\n" -> concatLines

concatStringsSep "\n" map -> concatMapStringsSep "\n"
This commit is contained in:
Gerg-L 2024-07-08 17:20:46 -04:00
commit 0c8dff8a89
No known key found for this signature in database
2 changed files with 10 additions and 10 deletions

View file

@ -2,7 +2,7 @@
{lib}: let {lib}: let
inherit (builtins) hasAttr head throw typeOf isList isAttrs isBool isInt isString isPath isFloat toJSON; inherit (builtins) hasAttr head throw typeOf isList isAttrs isBool isInt isString isPath isFloat toJSON;
inherit (lib.attrsets) mapAttrsToList filterAttrs; inherit (lib.attrsets) mapAttrsToList filterAttrs;
inherit (lib.strings) concatStringsSep concatMapStringsSep stringToCharacters; inherit (lib.strings) concatStringsSep concatMapStringsSep stringToCharacters concatLines;
inherit (lib.trivial) boolToString warn; inherit (lib.trivial) boolToString warn;
in rec { in rec {
wrapLuaConfig = { wrapLuaConfig = {
@ -11,7 +11,7 @@ in rec {
luaAfter ? "", luaAfter ? "",
}: '' }: ''
lua << EOF lua << EOF
${concatStringsSep "\n" [luaBefore luaConfig luaAfter]} ${concatLines [luaBefore luaConfig luaAfter]}
EOF EOF
''; '';

View file

@ -6,7 +6,7 @@
inherit (builtins) map mapAttrs toJSON filter; inherit (builtins) map mapAttrs toJSON filter;
inherit (lib.options) mkOption; inherit (lib.options) mkOption;
inherit (lib.attrsets) filterAttrs getAttrs attrValues attrNames; inherit (lib.attrsets) filterAttrs getAttrs attrValues attrNames;
inherit (lib.strings) isString concatStringsSep; inherit (lib.strings) isString concatLines concatMapStringsSep;
inherit (lib.misc) mapAttrsFlatten; inherit (lib.misc) mapAttrsFlatten;
inherit (lib.trivial) showWarnings; inherit (lib.trivial) showWarnings;
inherit (lib.types) str nullOr; inherit (lib.types) str nullOr;
@ -126,7 +126,7 @@ in {
in { in {
vim = { vim = {
configRC = { configRC = {
globalsScript = entryAnywhere (concatStringsSep "\n" globalsScript); globalsScript = entryAnywhere (concatLines globalsScript);
# Call additional lua files with :luafile in Vimscript # Call additional lua files with :luafile in Vimscript
# section of the configuration, only after # section of the configuration, only after
@ -134,14 +134,14 @@ in {
extraLuaFiles = let extraLuaFiles = let
callLuaFiles = map (file: "luafile ${file}") cfg.extraLuaFiles; callLuaFiles = map (file: "luafile ${file}") cfg.extraLuaFiles;
in in
entryAfter ["globalScript"] (concatStringsSep "\n" callLuaFiles); entryAfter ["globalScript"] (concatLines callLuaFiles);
# wrap the lua config in a lua block # wrap the lua config in a lua block
# using the wrapLuaConfic function from the lib # using the wrapLuaConfic function from the lib
luaScript = let luaScript = let
mapResult = result: (wrapLuaConfig { mapResult = result: (wrapLuaConfig {
luaBefore = "${cfg.luaConfigPre}"; luaBefore = "${cfg.luaConfigPre}";
luaConfig = concatStringsSep "\n" (map mkLuarcSection result); luaConfig = concatLines (map mkLuarcSection result);
luaAfter = "${cfg.luaConfigPost}"; luaAfter = "${cfg.luaConfigPost}";
}); });
@ -155,7 +155,7 @@ in {
extraPluginConfigs = let extraPluginConfigs = let
mapResult = result: (wrapLuaConfig { mapResult = result: (wrapLuaConfig {
luaConfig = concatStringsSep "\n" (map mkLuarcSection result); luaConfig = concatLines (map mkLuarcSection result);
}); });
extraPluginsDag = mapAttrs (_: { extraPluginsDag = mapAttrs (_: {
@ -189,7 +189,7 @@ in {
icmap icmap
allmap allmap
]; ];
mapConfig = wrapLuaConfig {luaConfig = concatStringsSep "\n" (map (v: concatStringsSep "\n" v) maps);}; mapConfig = wrapLuaConfig {luaConfig = concatLines (map concatLines maps);};
in in
entryAfter ["globalsScript"] mapConfig; entryAfter ["globalsScript"] mapConfig;
}; };
@ -200,10 +200,10 @@ in {
failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions); failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
baseSystemAssertWarn = baseSystemAssertWarn =
if failedAssertions != [] if failedAssertions != []
then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}" then throw "\nFailed assertions:\n${concatMapStringsSep "\n" (x: "- ${x}") failedAssertions}"
else showWarnings config.warnings; else showWarnings config.warnings;
mapResult = result: (concatStringsSep "\n" (map mkVimrcSection result)); mapResult = result: concatMapStringsSep "\n" mkVimrcSection result;
vimConfig = resolveDag { vimConfig = resolveDag {
name = "vim config script"; name = "vim config script";
dag = cfg.configRC; dag = cfg.configRC;