1
0
Fork 0
dotfiles/fish/conf.d/envsource.fish

13 lines
308 B
Fish

function envsource
if not set -q argv[1]
set argv[1] ".env"
end
echo "Using $argv[1] as input file"
for line in (grep -v '^\s*\(#\|$\)' $argv[1] | grep -E '^[A-Za-z_]+=[^#\n]+')
set item (string split -m 1 '=' $line)
set -gx $item[1] $item[2]
echo "Exported key $item[1]"
end
end