Open darkn3rd opened 5 months ago
@marc0der I suppose if a bash_profile
doesn't exist we shouldn't append to it.
I expected that sdk could not edit my shell startup files, but would instead prompt to edit them.
Most people would opt out and then wonder why SDKMAN isn't working. I'd expect a deluge of support requests. It would also break all noninteracive CI installations that depend on our installation script.
@helpermethod I agree, not creating the file sounds like a better approach. We could also be more explicit in the installation script about what changes we are making to your shell initialisation scripts.
In general, if a file doesn't exist, don't touch it. If we change one, log clearly what we have done.
The question is, do you want to support and test the vast number of variable configurations between Mac/Linux/Win terminal behavior across different shells, and possibly test with other toolchains that modify the shell to make sure no conflicts. Or perhaps, assume that using command line tools should require a minimum familiarity of shell knowledge (segue: this used to be a required course, e.g. "intro to shell (programming)", back in the day). Popular environments like rbenv and pyenv let the user decide and have an option for auto-configure should the users want this.
Some other options are to prompt users if they want autoconfiguration. If you decide to keep the autoconfiguration, could you provide an option turn it off, such as an env var or something? In my use case, installing SDKMAN disrupted 5 other tool chains, so I would rather be prompted on what I need to add to my shell environment, especially as I float between zsh and bash.
So I went and looked at the code and realised that we had implemented some functionality around this many years ago. For more details, you can read the section Install without modifying shell config on the installation page of our website.
Bug report
After installing JDK and SDK with
sdk
cli, my shell environment was misconfigured.To reproduce
Use a
.profile
to call appropriate shell configuration:Actual Results
A new file was created
.bash_profile
withBecause of this, my
.profile
is never loaded.I have other tools that are no longer available, because Homebrew env/paths, rbenv, pyenv, asdf (kubectl, terraform), nvm, etc. were not available after installing sdkman.
Expected Results
I expected that sdk could not edit my shell startup files, but would instead prompt to edit them. If I wanted
sdk
to automatically edit my shell startup files, then I would run something likesdk init
.System info
sdk version