ofek / userpath

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

Export new path automatically #34

Closed tomelliff closed 3 years ago

tomelliff commented 3 years ago

I might be missing something but coming across to this project from pipx I was surprised that it wants you to open a new terminal or re-login instead of either exporting the new path into the current terminal or sourcing the config file to export the new path.

Is there a reason behind avoiding doing this?

In particular I was looking at https://gitlab.com/meltano/meltano/-/merge_requests/1960 where they are trying to run getting started documentation script steps in CI to check that they haven't been broken and while the first error that it's currently stuck on (https://gitlab.com/aaronsteers/meltano/-/jobs/892335076) is fixable by correctly calling python3 -m pipx ensurepath they'd need to prefix all the pipx commands with python3 -m which is awkward and not what you'd expect users to do.

More importantly it feels like a nicer user experience to run userpath or pipx ensurepath and then just move on as normal without having to re-login to their terminal or start a new session.

ThatXliner commented 3 years ago

Well, it edits your startup file. And for the current shell session to be affected, it has to reload the startup file

tomelliff commented 3 years ago

I realised last night that it's running as a child process of the shell and so can't affect the environment of the parent process so even if it was to source the config/startup file or export the new path then it won't have any effect.

Derp.