summaryrefslogtreecommitdiffstats
path: root/krebs/4lib
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-08-28 20:11:03 +0200
committertv <tv@shackspace.de>2015-08-28 20:15:57 +0200
commitf6997378c91be84432703183397f8675143030e9 (patch)
tree730d48f2d55826e418eb4ce3525f4d995b812f6d /krebs/4lib
parent015720ef89b81d3d17b3aa7dcaa1e1489c0f87a8 (diff)
krebs shell: add cat
Diffstat (limited to 'krebs/4lib')
-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}";
}