oh-my-fish / plugin-foreign-env

Run foreign bash scripts and capture exported environment variables
MIT License
229 stars 15 forks source link

feature: print output instead of executing #25

Open kevingriffin opened 3 years ago

kevingriffin commented 3 years ago

This pull requests adds a -p/--print flag to fenv which allows for outputting the set commands generated instead of executing them.

The motivation for this way to move the calls to fenv from shell start time to configuration generation time in nix.

It's a bit expensive to call fenv on every shell launch, but it would be possible to translate the bash environment file once and cache the result as native fish set commands.

kevingriffin commented 3 years ago

It occurs to me after some more testing that it's not valid to do interpolation eagerly when computing for use later, so some sort of approach where keys with values that have interpolation in them needs to be implemented in order to insert a transformed interpolation call later. I'll see if I can get that in.