summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-09-19 20:50:00 +0200
committertv <tv@krebsco.de>2017-09-19 20:58:23 +0200
commit9f85824da25311ec096d748798f49d09519e16aa (patch)
treedfbd427a1c90889821c041ce741641aeb006d7ef /krebs/5pkgs/simple
parent8179f87e5a434ebb21219b657c05a11e6811525f (diff)
withGetopt: make long option optional
Diffstat (limited to 'krebs/5pkgs/simple')
-rw-r--r--krebs/5pkgs/simple/withGetopt.nix12
1 files changed, 8 insertions, 4 deletions
diff --git a/krebs/5pkgs/simple/withGetopt.nix b/krebs/5pkgs/simple/withGetopt.nix
index 21322b783..b7bd40126 100644
--- a/krebs/5pkgs/simple/withGetopt.nix
+++ b/krebs/5pkgs/simple/withGetopt.nix
@@ -45,9 +45,11 @@ in writeDash wrapper-name ''
args=$(${utillinux}/bin/getopt \
-n "$wrapper_name" \
-o "" \
- -l ${concatMapStringsSep ","
- (opt: opt.long + optionalString (!opt.switch) ":")
- (attrValues opts)} \
+ -l ${shell.escape
+ (concatMapStringsSep ","
+ (opt: opt.long + optionalString (!opt.switch) ":")
+ (filter (opt: opt.long != null)
+ (attrValues opts)))} \
-s sh \
-- "$@")
if \test $? != 0; then exit 1; fi
@@ -65,7 +67,9 @@ in writeDash wrapper-name ''
shift 2
''}
;;
- '') opts)}
+ '') (filterAttrs
+ (_: opt: opt.long != null)
+ opts))}
--)
shift
break