-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrong shell #3
Comments
I would very much appreciate not adding the PATH to all my shell files |
You can check how https://github.com/mklabs/tabtab does it EDIT: disregard this comment. looks like they just ask the user https://github.com/mklabs/tabtab/blob/db75a56c3935bfffb0d528286f6aa23b4035a675/lib/prompt.js#L5-L49 |
I thought I'd tested zsh, but I see now I didn't (zsh was inheriting the path from the parent shell). Thankfully, xonsh seems to do the right thing, presumably inheriting from the .bash_profile or .bashrc (though I don't see in the docs where that's meant to happen). I think I'd assumed if userpath worked for xonsh that it likely worked for less obscure shells, but it's clear to me with a little testing that there's no obvious way to do it and may not even be a way to do it in the general case. If only Unix had a convention where environment variables could be specified per-user without being shell-specific.
Of the two options, the second one seems preferable to me. Sounds like you're on the right track! |
What is "everything" here? I vote to form a heuristic to determine the best single file to modify (i.e. SHELL and OS), and to only modify that single file if there is enough confidence from the heuristic. |
I saw this answer that purports that |
A related issue in that it varies across OSes which I just uncounted (and which could be relevant to your situation @jaraco): Ubuntu defaults to providing a .profile (and not a The catch is that if a |
@ofek I have not been following the conversation so forgive me if this has already been covered but I still have some concerns. as @cs01 stated:
the latest version is still appending to both |
@AlJohri It will (usually) be 2 files per shell: 1 for login ( If you want, I could add another flag |
I think we should handle the cases that are known. I would also like to see a CLI option and environment variable where I can manually define the file I want the PATH to go in. For example, I personally use Here's my thoughts so far on detection using OS+Shell: general note on bash quirk: in bash, the login-shell only runs the this means, that an interative, login shell will not automatically source bashrc. other shells such as zsh do not have this strange behavior. in zsh, if its an interactive shell, it will run zshrc regardless of login or non-login. this is why only bash requires sourcing bashrc from the profile. for bash, there have two approaches on non-macos systems:
I'm personally more in favor of the latter but I don't work on linux systems everyday so open to feedback here. I think it's bad practice to populate PATHs in two places and would like to avoid that as much as possible. general note on /etc/profile quirk: on macos, arch linux, and potentially other distributions, the this gets run after Rules
Open to feedback! I'm a macOS user so I mostly care about the macOS rules but I think having a smart set of defaults that works for most users and is overridable/configurable when needed is best. |
Some Example Docker Commands to Verify the Above Notes: macOS
Ubuntu
Arch
Fedora
|
@AlJohri Ah wow thanks, I didn't know that behavior was only bash! I'll tackle this over the weekend. |
no problem. I mentioned "two approaches on non-macos systems" above, one requiring the user to re-login but modifying only a single file and the other modifies two files but does not require the user to re-login. I personally lean toward asking the user to re-login for future terminal sessions or they can manually source the What do you think? |
I agree with modifying a single file and having the user re-login. |
@ofek just checking in- let me know if you need any help. would love to get this wrapped up |
I'm sorry, but I have to make a very unexpected move and therefore lack free time currently. I would gladly accept a PR. |
best of luck with the move- I don't have time to submit a PR right now but will check back in in a week or so |
hey @ofek, just checking in to see if you have some more time soon |
@ofek I have some time to work on this month- are you available to review a PR in the near future? |
Yes for sure!!! |
|
@ofek
userpath
doesn't work for my setup locally so I'm having some trouble testing.Here are my dotfiles in case it helps: https://github.com/AlJohri/dotfiles
Issues:
~/.zprofile
and~/.zshrc
were untouchedThe text was updated successfully, but these errors were encountered: