diff options
author | lassulus <lassulus@lassul.us> | 2017-09-19 22:56:19 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2017-09-19 22:56:19 +0200 |
commit | 821e59baca98b5caba65c6e7c7e4d6671593a69e (patch) | |
tree | 499e78ef143bf20c7cb2ef4137d031085d25c6a9 /shell.nix | |
parent | d30480f1457cf4ac4f67f5e02faec75765706e50 (diff) | |
parent | 94c57badae775cb863b76a6c6cb8c11012cd4f83 (diff) |
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'shell.nix')
-rw-r--r-- | shell.nix | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -111,19 +111,13 @@ let # usage: parse-target [--default=TARGET] TARGET # TARGET = [USER@]HOST[:PORT][/PATH] - cmds.parse-target = pkgs.writeDash "cmds.parse-target" '' + cmds.parse-target = pkgs.withGetopt { + default_target = { + long = "default"; + short = "d"; + }; + } (opts: pkgs.writeDash "cmds.parse-target" '' set -efu - args=$(${pkgs.utillinux}/bin/getopt -n "$0" -s sh \ - -o d: \ - -l default: \ - -- "$@") - if \test $? != 0; then exit 1; fi - eval set -- "$args" - default_target= - while :; do case $1 in - -d|--default) default_target=$2; shift 2;; - --) shift; break;; - esac; done target=$1; shift for arg; do echo "$0: bad argument: $arg" >&2; done if \test $# != 0; then exit 2; fi @@ -142,7 +136,7 @@ let ($default_target | parse) + ($target | parse | sanitize) | . + { local: (.user == env.LOGNAME and .host == env.HOSTNAME) } ''} - ''; + ''); # usage: quote [ARGS...] cmds.quote = pkgs.writeDash "cmds.quote" '' |