ofek / userpath

Cross-platform tool for adding locations to the user PATH, no elevated privileges required!
MIT License
151 stars 20 forks source link

bash: create either ~/.profile or ~/.bash_profile depending on which exist only #36

Closed itsayellow closed 3 years ago

itsayellow commented 3 years ago

This my attempt to fix #19

The logic here is attempting to code @AlJohri's mention of what files to modify from https://github.com/ofek/userpath/issues/3#issuecomment-512973913, specifically:

profile/bash_profile means use whichever file already exists, defaulting to bash_profile

I dispensed with checking if we're on the ubuntu distro (and the distro dependency) in favor of just noting which of ~/.profile and/or ~/.bash_profile exist. I pick one, and only upgrade ~/.profile if it is the only one that currently exists in a user's home directory.

I wasn't able to get the tests working in my local computer (possibly because I'm on macOS) so hopefully on a pull request the CI will test this code.

itsayellow commented 3 years ago

@ofek do you have any guidance? I'm going to change this to "Ready to Review".

ofek commented 3 years ago

Thanks!