diff options
author | Silvan Mosberger <contact@infinisil.com> | 2023-01-31 18:05:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-31 18:05:53 +0100 |
commit | 50e4dbf35b95fd2b96718b656ebcbc6f9fa3a4ab (patch) | |
tree | cc90137eb87bb1afc11293c88a86edfa2df75805 /lib/strings.nix | |
parent | a743cf65d36af9633fe758092e54b0ba4f1f43e7 (diff) | |
parent | ed0b8c26f127525a9ee66f895bdc894cdaa5d685 (diff) |
Merge pull request #205557 from ncfavier/concatLines
lib/strings: add `concatLines`
Diffstat (limited to 'lib/strings.nix')
-rw-r--r-- | lib/strings.nix | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/strings.nix b/lib/strings.nix index 2188fcb1dbfd1..68d9309506625 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -128,6 +128,17 @@ rec { # List of input strings list: concatStringsSep sep (lib.imap1 f list); + /* Concatenate a list of strings, adding a newline at the end of each one. + Defined as `concatMapStrings (s: s + "\n")`. + + Type: concatLines :: [string] -> string + + Example: + concatLines [ "foo" "bar" ] + => "foo\nbar\n" + */ + concatLines = concatMapStrings (s: s + "\n"); + /* Construct a Unix-style, colon-separated search path consisting of the given `subDir` appended to each of the given paths. |