nufeb / NUFEB

Official release of the NUFEB software
http://research.ncl.ac.uk/nufeb/
GNU General Public License v3.0
18 stars 16 forks source link

Support setting PATH in multiple shells #15

Open joeweaver opened 3 years ago

joeweaver commented 3 years ago

Right now, the install script assumes bash and doesn't update the correct *rc file for other shells. In my case, I use Zsh and the relevant file is ~/.zshrc.

In that specific case, it's easy enough to check for a ~/.zshrc file and update that instead of (or in addition to?) ~/.bashrc. There's also the option to do something smart by checking whatever $SHELL is set to.

Thinking about supporting additional shells is what makes this a bit more complicated. I assume things like FISH, and OIL have similar files, but I'm not familiar with them so that makes testing/maintenance hard.

On the other hand, requiring devs to live in bash is a bit restrictive.

We probably shouldn't be directly updating the user's rc files anyway. I know one approach, such as used by OpenFoam, is to:

  1. Create an rc snippet in somewhere user-accessble (like $HOME/.config/<appname>)
  2. On installation tell the user to source $HOME/.config/<appname>/.<shell>rc when they want to run the app
  3. Assume users who don't want to source every time/use a different shell know enough will be able to grab the relevant bits from that file and a. Incorporate it into their ~/.rc b. Adapt the snippet to their preferred shell

Not a big deal overall, just trying to log these as issues while I'm still a beginner at NUFEB dev and before I forget them.

There's similar issues with the third party installs, which should be written up as an issue as well.

shelllbw commented 3 years ago

Thanks, Joe. That's helpful. I will find a time to improve this.

joeweaver commented 3 years ago

I'm happy to do the implementation.

Which approach do you think is better?

  1. directly editing the rc files for diffrent shells or
  2. the OpenFOAM style bash-snippet approach