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:
parent
d3c46c9442
commit
2cda9f7113
1 changed files with 11 additions and 2 deletions
|
@ -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"
|
||||
;;
|
||||
|
|
Loading…
Add table
Reference in a new issue