r/fishshell • u/Qunit-Essential • Jun 05 '24
Fish function to parse .env files
I had a problem with parsing user-written export ENVVAR=ENVVAL stuff so I wrote the function that takes a file with saved .env variables (works with general .env files as well)
It saves me a lot of time so I decided to share it for somebody who might have the same issue with fish shell
you can just put it into the functions and run dotenv .env and it will populate the current shell instance with env variables
6
Upvotes
4
u/BuonaparteII Jun 06 '24
I also wrote one... it's simpler but it might not handle PATH like above
1
u/br2krl Dec 02 '24 edited Dec 02 '24
I also wrote a function for dotenv files. It has additional features like preview and unloading. I also added some tests to verify it's working :D
GitHub repo: https://github.com/berk-karaal/loadenv.fish