Skip to content
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

feat: Report missing plugins and install plugins in defined order #1970

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

andrecloutier
Copy link
Contributor

@andrecloutier andrecloutier commented Feb 18, 2025

Summary

This PR adds two features:

  • Indicates in the "install" output if a requested tool/version could not be installed due to the plugin not being installed. This will cause the application to exit with a non-zero exit code. This is functionality that existed in the bash version of the tool and is useful to inform the user that their environment requires additional setup.
  • Installs versions based on the order defined in the tool-version files. This is the go equivalent implementation of feat: install dependencies in .tool-versions order #1723 .

Other Information

Sample output:

andre@Andres-MBP asdf % ./asdf install
version 1.23.4 of golang is already installed
version 1.8.2 of bats is already installed
version 0.9.0 of shellcheck is already installed
version 3.6.0 of shfmt is already installed
missing plugin for unknown-plugin
version 8.12.1 of gradle is already installed
version zulu-21.40.17 of java is already installed
version 27.2.2 of erlang is already installed
version 1.18.2-otp-27 of elixir is already installed
andre@Andres-MBP asdf % echo $?
1

@andrecloutier andrecloutier changed the title Report missing plugins recursive fix: Report missing plugins recursively Feb 18, 2025
@andrecloutier andrecloutier force-pushed the report_missing_plugins_recursive branch 5 times, most recently from 6c1e051 to 1f7649c Compare February 19, 2025 03:16
@andrecloutier andrecloutier force-pushed the report_missing_plugins_recursive branch from 1f7649c to 554f6f9 Compare February 21, 2025 03:52
@andrecloutier andrecloutier changed the title fix: Report missing plugins recursively fix: Report missing plugins and install plugins in defined order Feb 21, 2025
@andrecloutier andrecloutier changed the title fix: Report missing plugins and install plugins in defined order feat: Report missing plugins and install plugins in defined order Feb 21, 2025
@andrecloutier andrecloutier force-pushed the report_missing_plugins_recursive branch from f9f78d7 to 5272a17 Compare February 21, 2025 05:11
@andrecloutier andrecloutier marked this pull request as ready for review February 21, 2025 05:16
@andrecloutier andrecloutier requested a review from a team as a code owner February 21, 2025 05:16
@@ -100,7 +101,7 @@ func LoadConfig() (Config, error) {
return config, err
}

homeDir, err := homedir.Dir()
homeDir, err := os.UserHomeDir()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are replacing the library - it is being used here as well
https://github.com/asdf-vm/asdf/pull/1970/files#diff-54c7c1af5fa8d5db4dc49f0e8e80e93ba2b1183ba4d5c9e2e5729e6deae6a3cdL207

There is a related issue
#1923

Copy link
Contributor Author

@andrecloutier andrecloutier Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it here since it's a fairly safe change. Nothing else appears to be reading from config.Home prior to this change and the current implementation of install was already relying on os.UserHomeDir(). I think removing the other usages merit its own PR. Seems trivial but I'm not confident enough w/ this code base yet to say there aren't edge cases to consider.

@andrecloutier
Copy link
Contributor Author

@Stratus3D - Ready for some 👀 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants