mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-11-08 19:46:11 +01:00
fix environment variable dump extraction
Grep does not work across multiple lines. However the output of direnv is on a single anyway.
This commit is contained in:
parent
d0dc1479ea
commit
e7df598cd0
1 changed files with 2 additions and 2 deletions
4
direnvrc
4
direnvrc
|
|
@ -17,9 +17,9 @@ use_nix() {
|
|||
[[ shell.nix -nt "$cache" ]];
|
||||
then
|
||||
[ -d .direnv ] || mkdir .direnv
|
||||
local dump_cmd="echo \<direnv\>; \"$direnv\" dump bash; echo \</direnv\>"
|
||||
local dump_cmd="echo -n _____direnv_____; \"$direnv\" dump bash"
|
||||
local tmp=$(nix-shell --show-trace --pure "$@" \
|
||||
--run "$dump_cmd" | grep -oP '(?<=<direnv>).*?(?=</direnv>)')
|
||||
--run "$dump_cmd" | grep -oP '(?<=_____direnv_____).*')
|
||||
echo "$tmp" > "$cache"
|
||||
update_drv=1
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue