stockholm/krebs/5pkgs/simple/quote.nix

14 lines
218 B
Nix
Raw Permalink Normal View History

2017-10-17 18:01:53 +00:00
{ 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
''