summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r--krebs/5pkgs/simple/populate/default.nix4
-rw-r--r--krebs/5pkgs/simple/quote.nix13
-rw-r--r--krebs/5pkgs/simple/withGetopt.nix5
3 files changed, 19 insertions, 3 deletions
diff --git a/krebs/5pkgs/simple/populate/default.nix b/krebs/5pkgs/simple/populate/default.nix
index 3989585a..78ee2f04 100644
--- a/krebs/5pkgs/simple/populate/default.nix
+++ b/krebs/5pkgs/simple/populate/default.nix
@@ -13,12 +13,12 @@ in
stdenv.mkDerivation rec {
name = "populate";
- version = "1.2.4";
+ version = "1.2.5";
src = fetchgit {
url = http://cgit.ni.krebsco.de/populate;
rev = "refs/tags/v${version}";
- sha256 = "0az41vaxfwrh9l19z3cbc7in8pylrnyc0xkzk6773xg2nj4g8a28";
+ sha256 = "10s4x117zp5whqq991xzw1i2jc1xhl580kx8hhzv8f1b4c9carx1";
};
phases = [
diff --git a/krebs/5pkgs/simple/quote.nix b/krebs/5pkgs/simple/quote.nix
new file mode 100644
index 00000000..7731e14b
--- /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
+''
diff --git a/krebs/5pkgs/simple/withGetopt.nix b/krebs/5pkgs/simple/withGetopt.nix
index 196e6765..179051bd 100644
--- a/krebs/5pkgs/simple/withGetopt.nix
+++ b/krebs/5pkgs/simple/withGetopt.nix
@@ -1,5 +1,5 @@
with import <stockholm/lib>;
-{ utillinux, writeDash }:
+{ coreutils, quote, utillinux, writeDash }:
opt-spec: cmd-spec: let
@@ -43,6 +43,9 @@ in writeDash wrapper-name ''
unset ${opt.varname}
'') opts)}
+ WITHGETOPT_ORIG_ARGS=$(${quote}/bin/quote "$@")
+ export WITHGETOPT_ORIG_ARGS
+
args=$(${utillinux}/bin/getopt \
-l ${shell.escape
(concatMapStringsSep ","