diff options
| author | tv <tv@krebsco.de> | 2015-03-17 07:47:09 +0100 | 
|---|---|---|
| committer | tv <tv@krebsco.de> | 2015-05-19 23:10:57 +0200 | 
| commit | 879f0b21d3be6e23be7092b04e970b5ec710370b (patch) | |
| tree | 6f15d4a090b495b0cc248d63c71b0a869afc7acf | |
| parent | 7fe0cff46a59726287501a34101756e89f67f249 (diff) | |
lib shell-escape: use builtins.match
| -rw-r--r-- | lib/default.nix | 9 | 
1 files changed, 8 insertions, 1 deletions
| diff --git a/lib/default.nix b/lib/default.nix index c1663a7..995e3db 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -40,5 +40,12 @@ in    #setToList = setMap (_: v: v);    shell-escape = -    stringAsChars (c: if c == "\n" then ''"${c}"'' else "\\${c}"); +    let +      isSafeChar = c: match "[-./0-9_a-zA-Z]" c != null; +    in +    stringAsChars (c: +      if isSafeChar c then c +      else if c == "\n" then "'\n'" +      else "\\${c}"); +  } | 
