mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 03:30:45 +00:00
stdenv: substituteInPlace: accept multiple filenames
I don't know if getopt is available everywhere, so I did not use it. in any case, it can be changed to use getopt in the future if needed.
This commit is contained in:
parent
c30f66c6c7
commit
ba1efa71ae
|
@ -913,9 +913,9 @@ substitute ./foo.in ./foo.out \
|
|||
--subst-var someVar
|
||||
```
|
||||
|
||||
### `substituteInPlace` \<file\> \<subs\> {#fun-substituteInPlace}
|
||||
### `substituteInPlace` \<multiple files\> \<subs\> {#fun-substituteInPlace}
|
||||
|
||||
Like `substitute`, but performs the substitutions in place on the file \<file\>.
|
||||
Like `substitute`, but performs the substitutions in place on the files passed.
|
||||
|
||||
### `substituteAll` \<infile\> \<outfile\> {#fun-substituteAll}
|
||||
|
||||
|
|
|
@ -771,9 +771,18 @@ substitute() {
|
|||
}
|
||||
|
||||
substituteInPlace() {
|
||||
local fileName="$1"
|
||||
shift
|
||||
substitute "$fileName" "$fileName" "$@"
|
||||
local -a fileNames=()
|
||||
for arg in "$@"; do
|
||||
if [[ "$arg" = "--"* ]]; then
|
||||
break
|
||||
fi
|
||||
fileNames+=("$arg")
|
||||
shift
|
||||
done
|
||||
|
||||
for file in "${fileNames[@]}"; do
|
||||
substitute "$file" "$file" "$@"
|
||||
done
|
||||
}
|
||||
|
||||
_allFlags() {
|
||||
|
|
Loading…
Reference in a new issue