Util : Fix catAllText extra tabs at newlines.

This commit is contained in:
Dmitry Voronin 2024-04-30 20:36:50 +03:00
parent 17d354489f
commit f5d325a414
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
2 changed files with 6 additions and 8 deletions

View file

@ -1,6 +1,6 @@
{ pkgs, wallpaper, style, util, setting, ... } @args: let { pkgs, wallpaper, style, util, setting, ... } @args: let
mkConfig = { modules }: builtins.foldl' (acc: mod: mkConfig = { modules }: builtins.foldl' (acc: mod:
acc + (import mod args).text acc + util.trimTabs((import mod args).text)
) "" modules; ) "" modules;
swayRc = mkConfig { swayRc = mkConfig {
@ -27,9 +27,9 @@
]; ];
}; };
in { in {
config = util.trimTabs ('' config = (util.trimTabs ''
# Read `man 5 sway` for a complete reference. # Read `man 5 sway` for a complete reference.
include /etc/sway/config.d/* include /etc/sway/config.d/*
'' + swayRc); '') + swayRc;
} }

View file

@ -11,9 +11,7 @@
ls = path: map (f: "${path}/${f}") (builtins.attrNames (builtins.readDir path)); ls = path: map (f: "${path}/${f}") (builtins.attrNames (builtins.readDir path));
# Concat all files by `text` key. # Concat all files by `text` key.
catAllText = path: args: trimTabs ( catAllText = path: args: builtins.foldl' (acc: mod:
(builtins.foldl' (acc: mod: acc + trimTabs ((import mod args).text)
acc + (import mod args).text ) "" (ls path);
) "" (ls path))
);
} }