summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-10-17 20:01:53 +0200
committertv <tv@krebsco.de>2017-10-17 20:01:53 +0200
commita15736cbb0f23e74b47decc363a4cbf45850a0c4 (patch)
tree0c52b2d8cdc0caa27b040adcaf768eea2aef86cc /krebs/5pkgs
parent8b55369fa72e1b4b518a41cc221420910c924108 (diff)
quote: init
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r--krebs/5pkgs/simple/quote.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/quote.nix b/krebs/5pkgs/simple/quote.nix
new file mode 100644
index 000000000..7731e14bf
--- /dev/null
+++ b/krebs/5pkgs/simple/quote.nix
@@ -0,0 +1,13 @@
+{ jq, writeDashBin }:
+
+# usage: quote [ARGS...]
+writeDashBin "quote" ''
+ set -efu
+ prefix=
+ for x; do
+ y=$(${jq}/bin/jq -nr --arg x "$x" '$x | @sh "\(.)"')
+ echo -n "$prefix$y"
+ prefix=' '
+ done
+ echo
+''