feat(fish): add sourceenv script

dev-docs
Moritz Böhme 2023-09-19 09:50:51 +02:00
parent d4be10ddda
commit ef9706621b
1 changed files with 16 additions and 0 deletions

View File

@ -61,6 +61,22 @@ in
functions = { functions = {
fish_greeting = ""; fish_greeting = "";
cheat = "cht.sh $argv | bat -p"; cheat = "cht.sh $argv | bat -p";
sourceenv = ''
set -f envfile "$argv"
if not test -f "$envfile"
echo "Unable to load $envfile"
return 1
end
printf "exported"
while read line
if not string match -qr '^#|^$' "$line"
set item (string split -m 1 '=' $line)
printf " $item[1]"
set -gx "$item[1]" "$item[2]"
end
end < "$envfile"
printf "\n"
'';
}; };
}; };
}; };