makeWrapper: Add --prefix-each
flag (#145104)
This is for symmetry with `--suffix-each`, and also because (in my limited experience), `--prefix-each` is more useful since it ensures that the new entries superseded the existing `PATH` entries
This commit is contained in:
parent
bf27c67927
commit
07f1f2ca9c
@ -23,6 +23,7 @@ assertExecutable() {
|
||||
|
||||
# --prefix ENV SEP VAL : suffix/prefix ENV with VAL, separated by SEP
|
||||
# --suffix
|
||||
# --prefix-each ENV SEP VALS : like --prefix, but VALS is a list
|
||||
# --suffix-each ENV SEP VALS : like --suffix, but VALS is a list
|
||||
# --prefix-contents ENV SEP FILES : like --suffix-each, but contents of FILES
|
||||
# are read first and used as VALS
|
||||
@ -73,6 +74,14 @@ makeWrapper() {
|
||||
echo "export $varName=${value@Q}\${$varName:+${separator@Q}}\$$varName" >> "$wrapper"
|
||||
fi
|
||||
fi
|
||||
elif [[ "$p" == "--prefix-each" ]]; then
|
||||
varName="${params[$((n + 1))]}"
|
||||
separator="${params[$((n + 2))]}"
|
||||
values="${params[$((n + 3))]}"
|
||||
n=$((n + 3))
|
||||
for value in $values; do
|
||||
echo "export $varName=${value@Q}\${$varName:+${separator@Q}}\$$varName" >> "$wrapper"
|
||||
done
|
||||
elif [[ "$p" == "--suffix-each" ]]; then
|
||||
varName="${params[$((n + 1))]}"
|
||||
separator="${params[$((n + 2))]}"
|
||||
|
Loading…
Reference in New Issue
Block a user