Skip to content

Commit f8f97f8

Browse files
committed
Issue deprecation notice for eclipsed legacy commands
1 parent 7280765 commit f8f97f8

File tree

6 files changed

+20
-0
lines changed

6 files changed

+20
-0
lines changed

src/main/bash/sdkman-default.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#
1818

1919
function __sdk_default() {
20+
__sdkman_deprecation_notice "default"
2021
local candidate version
2122

2223
candidate="$1"

src/main/bash/sdkman-help.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#
1818

1919
function __sdk_help() {
20+
__sdkman_deprecation_notice "help"
2021
__sdkman_echo_no_colour ""
2122
__sdkman_echo_no_colour "Usage: sdk <command> [candidate] [version]"
2223
__sdkman_echo_no_colour " sdk offline <enable|disable>"

src/main/bash/sdkman-home.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#
1818

1919
function __sdk_home() {
20+
__sdkman_deprecation_notice "home"
2021
local candidate version
2122

2223
candidate="$1"

src/main/bash/sdkman-uninstall.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#
1818

1919
function __sdk_uninstall() {
20+
__sdkman_deprecation_notice "uninstall"
2021
local candidate version current
2122

2223
candidate="$1"

src/main/bash/sdkman-utils.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,18 @@ function __sdkman_echo_confirm() {
110110
echo -e -n "\033[1;33m$1\033[0m"
111111
fi
112112
}
113+
114+
function __sdkman_deprecation_notice() {
115+
local message="[Deprecation Notice]:
116+
This legacy '$1' command is replaced by a native implementation
117+
and it will be removed in a future release.
118+
Learn more at https://sdkman.io/native
119+
"
120+
121+
if [[ "$sdkman_colour_enable" == 'false' ]]; then
122+
__sdkman_echo_no_colour "$message"
123+
else
124+
__sdkman_echo_yellow "$message"
125+
fi
126+
}
127+

src/main/bash/sdkman-version.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#
1818

1919
function __sdk_version() {
20+
__sdkman_deprecation_notice "version"
2021
local version=$(cat $SDKMAN_DIR/var/version)
2122
echo ""
2223
__sdkman_echo_yellow "SDKMAN $version"

0 commit comments

Comments
 (0)