forked from Fediversity/Fediversity
smarter indent
this allows writing the beginning of the indented string at the desired indentation
This commit is contained in:
parent
e38960661c
commit
29839f82d7
|
@ -36,7 +36,15 @@ rec {
|
|||
splitLines = s: with builtins; filter (x: !isList x) (split "\n" s);
|
||||
|
||||
indent = prefix: s:
|
||||
join "\n" (map (x: if x == "" then x else "${prefix}${x}") (splitLines s));
|
||||
with lib.lists;
|
||||
let
|
||||
lines = splitLines s;
|
||||
in
|
||||
join "\n" (
|
||||
[ (head lines) ]
|
||||
++
|
||||
(map (x: if x == "" then x else "${prefix}${x}") (tail lines))
|
||||
);
|
||||
|
||||
types = rec {
|
||||
collection = elemType:
|
||||
|
|
Loading…
Reference in a new issue