summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/quote.nix
blob: 7731e14bf45209b9665053f13fc69ab4422009df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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
''