1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-13 20:30:02 +00:00

darwin-option: add support for -I

This commit is contained in:
Daiderd Jordan 2019-05-01 13:26:04 +02:00
parent d3c46c9442
commit 2cda9f7113
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -4,7 +4,7 @@ set -o pipefail
export PATH=@path@:$PATH
evalNix() {
nix-instantiate --eval --strict -E "with import <darwin> {}; $*"
nix-instantiate --eval --strict "${extraEvalFlags[@]}" -E "with import <darwin> {}; $*"
}
evalAttrs() {
@ -21,7 +21,7 @@ evalOptText() {
}
showSyntax() {
echo "$0: <option>" >&2
echo "$0: [-I path] <option>" >&2
eval printf "$(evalAttrs "options")"
echo
exit 1
@ -29,6 +29,7 @@ showSyntax() {
# Parse the command line.
origArgs=("$@")
extraEvalFlags=()
option=
while [ "$#" -gt 0 ]; do
@ -37,6 +38,14 @@ while [ "$#" -gt 0 ]; do
--help)
showSyntax
;;
-I)
if [ -z "$1" ]; then
echo "$0: $i requires an argument"
exit 1
fi
j="$1"; shift 1
extraEvalFlags+=("$i" "$j")
;;
*)
option="$i"
;;