mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
lib/zsh: exportAll add support for indentation
Allow indenting the output level Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
c75fd8e300
commit
64a809b198
1 changed files with 9 additions and 1 deletions
|
|
@ -30,5 +30,13 @@ rec {
|
||||||
# Given an attribute set containing shell variable names and their
|
# Given an attribute set containing shell variable names and their
|
||||||
# assignments, this function produces a string containing an export
|
# assignments, this function produces a string containing an export
|
||||||
# statement for each set entry.
|
# statement for each set entry.
|
||||||
exportAll = vars: lib.concatStringsSep "\n" (lib.mapAttrsToList export vars);
|
exportAll =
|
||||||
|
vars:
|
||||||
|
{
|
||||||
|
indent ? "",
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
separator = if indent == "" then "\n" else "\n" + indent;
|
||||||
|
in
|
||||||
|
lib.concatStringsSep separator (lib.mapAttrsToList export vars);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue