nix-helpers: 250903de08b7c1bef10cb87d115e2c5755e87b4a

     1: # Render a list of strings into a bash array, e.g. so they can be looped over
     2: # using 'for X in "${Y[@]}"; do ...; done'.
     3: # This should mostly be used for 'static' strings, since they will end up being
     4: # forced; if the strings use import-from-derivation, it might be better to use
     5: # nixListToBashArray (this may or may not be true...)
     6: { die, fail, lib, runCommand }:
     7: 
     8: with builtins;
     9: with lib;
    10: l:
    11: assert isList l || die {
    12:   error = "asBashArray expects a list";
    13:   type = typeOf l;
    14: };
    15: assert all isString l || die {
    16:   error = "asBashArray expects strings in the given list";
    17:   types = map typeOf l;
    18: };
    19: "( " + concatStringsSep " " (map lib.escapeShellArg l) + " )"

Generated by git2html.