summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--krebs/4lib/shell.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/krebs/4lib/shell.nix b/krebs/4lib/shell.nix
index 48b220f8..2a6da5c1 100644
--- a/krebs/4lib/shell.nix
+++ b/krebs/4lib/shell.nix
@@ -12,4 +12,11 @@ rec {
if isSafeChar c then c
else if c == "\n" then "'\n'"
else "\\${c}");
+
+ #
+ # shell script generators
+ #
+
+ # example: "${cat (toJSON { foo = "bar"; })} | jq -r .foo"
+ cat = s: "printf '%s' ${escape s}";
}