Skip to content

Commit

Permalink
Issue deprecation notice for eclipsed legacy commands
Browse files Browse the repository at this point in the history
  • Loading branch information
marc0der committed Dec 18, 2024
1 parent 7280765 commit f8f97f8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/bash/sdkman-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#

function __sdk_default() {
__sdkman_deprecation_notice "default"
local candidate version

candidate="$1"
Expand Down
1 change: 1 addition & 0 deletions src/main/bash/sdkman-help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#

function __sdk_help() {
__sdkman_deprecation_notice "help"
__sdkman_echo_no_colour ""
__sdkman_echo_no_colour "Usage: sdk <command> [candidate] [version]"
__sdkman_echo_no_colour " sdk offline <enable|disable>"
Expand Down
1 change: 1 addition & 0 deletions src/main/bash/sdkman-home.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#

function __sdk_home() {
__sdkman_deprecation_notice "home"
local candidate version

candidate="$1"
Expand Down
1 change: 1 addition & 0 deletions src/main/bash/sdkman-uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#

function __sdk_uninstall() {
__sdkman_deprecation_notice "uninstall"
local candidate version current

candidate="$1"
Expand Down
15 changes: 15 additions & 0 deletions src/main/bash/sdkman-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,18 @@ function __sdkman_echo_confirm() {
echo -e -n "\033[1;33m$1\033[0m"
fi
}

function __sdkman_deprecation_notice() {
local message="[Deprecation Notice]:
This legacy '$1' command is replaced by a native implementation
and it will be removed in a future release.
Learn more at https://sdkman.io/native
"

if [[ "$sdkman_colour_enable" == 'false' ]]; then
__sdkman_echo_no_colour "$message"
else
__sdkman_echo_yellow "$message"
fi
}

1 change: 1 addition & 0 deletions src/main/bash/sdkman-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#

function __sdk_version() {
__sdkman_deprecation_notice "version"
local version=$(cat $SDKMAN_DIR/var/version)
echo ""
__sdkman_echo_yellow "SDKMAN $version"
Expand Down

0 comments on commit f8f97f8

Please sign in to comment.