Sdkman packages
Index¶
- sdkman_packages::install_sdkman_package
- sdkman_packages::uninstall_package_version
- sdkman_packages::install_sdkman_packages
- sdkman_packages::get_installed_packages
- sdkman_packages::get_installed_packages_versions
- sdkman_packages::get_current_package_version
- sdkman_packages::prune_sdkman_package
- sdkman_packages::prune_sdkman_packages
sdkman_packages::install_sdkman_package¶
Install the latest version of an SDKMAN package.
Failure is signalled through the sdk install | sdkman::clean_output pipeline, so
the caller must have pipefail set for a failed install to be observable.
Arguments¶
- $1 (package): name (e.g. "gradle")
Exit codes¶
- 0: sdk install succeeded
- 1: sdk install failed (requires pipefail in the caller)
sdkman_packages::uninstall_package_version¶
Uninstall a specific version of an SDKMAN package.
Arguments¶
- $1 (package): name (e.g. "gradle")
- $2 (version): string to uninstall
sdkman_packages::install_sdkman_packages¶
Install the latest version of every SDKMAN package listed for this machine. A package that fails to install is logged and skipped rather than aborting the run, so one broken upstream package cannot take down the whole update. The number of such failures is reported through the out-variable named by $1, NOT through the exit status: this function always returns 0.
The caller MUST invoke this function bare — never inside an if condition, nor on
the left of || or &&. Bash disables errexit through the entire call tree of a
function evaluated in a condition context, which would stop a failed package-list
fetch from aborting the run and let it read as "nothing to do" instead. Calling bare
keeps errexit live for the packages::get_sdkman fetch (fatal, as it must be) while
the inner if ! below scopes suppression to the single sdk install call, which is
the only place a failure is meant to be survivable.
Arguments¶
- $1 (name): of the out-variable to assign the failed-package count to (passed as a name-ref)
Exit codes¶
- 0: always
- 1: the out-parameter name collides with the nameref this helper binds
sdkman_packages::get_installed_packages¶
Print the names of all installed SDKMAN packages (excluding java). Output: stdout — package names, one per line, sorted shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_packages::get_installed_packages_versions¶
Print all installed version strings for the given SDKMAN package. Output: stdout — version strings, one per line, sorted
Arguments¶
- $1 (package): name
sdkman_packages::get_current_package_version¶
Print the currently active version of the given SDKMAN package (via the 'current' symlink target). Output: stdout — active version string
Arguments¶
- $1 (package): name
sdkman_packages::prune_sdkman_package¶
Uninstall all versions of an SDKMAN package except the currently active one.
Arguments¶
- $1 (package): name
sdkman_packages::prune_sdkman_packages¶
Uninstall all outdated versions of every installed SDKMAN package (excluding java). shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.