diff --git a/src/main/bash/sdkman-help.sh b/src/main/bash/sdkman-help.sh index 8710175a..f5e56dc7 100644 --- a/src/main/bash/sdkman-help.sh +++ b/src/main/bash/sdkman-help.sh @@ -25,7 +25,7 @@ function __sdk_help { __sdkman_echo_no_colour " install or i [version] [local-path]" __sdkman_echo_no_colour " uninstall or rm " __sdkman_echo_no_colour " list or ls [candidate]" - __sdkman_echo_no_colour " use or u [version]" + __sdkman_echo_no_colour " use or u " __sdkman_echo_no_colour " default or d [version]" __sdkman_echo_no_colour " current or c [candidate]" __sdkman_echo_no_colour " upgrade or ug [candidate]" diff --git a/src/main/bash/sdkman-use.sh b/src/main/bash/sdkman-use.sh index be26a94c..2206f25b 100644 --- a/src/main/bash/sdkman-use.sh +++ b/src/main/bash/sdkman-use.sh @@ -21,23 +21,14 @@ function __sdk_use { candidate="$1" version="$2" + __sdkman_check_version_present "$version" || return 1 __sdkman_check_candidate_present "$candidate" || return 1 __sdkman_determine_version "$candidate" "$version" || return 1 if [[ ! -d "${SDKMAN_CANDIDATES_DIR}/${candidate}/${VERSION}" ]]; then echo "" __sdkman_echo_red "Stop! ${candidate} ${VERSION} is not installed." - if [[ "$sdkman_auto_answer" != 'true' ]]; then - echo "" - __sdkman_echo_confirm "Do you want to install it now? (Y/n): " - read install - fi - if [[ -z "$install" || "$install" == "y" || "$install" == "Y" ]]; then - __sdkman_install_candidate_version "$candidate" "$VERSION" - __sdkman_add_to_path "$candidate" - else - return 1 - fi + return 1 fi # Just update the *_HOME and PATH for this shell. diff --git a/src/test/cucumber/service_unavailable.feature b/src/test/cucumber/service_unavailable.feature index 75a5dfca..4e962bda 100644 --- a/src/test/cucumber/service_unavailable.feature +++ b/src/test/cucumber/service_unavailable.feature @@ -28,19 +28,12 @@ Feature: Service Unavailable # use command - Scenario: Use the default candidate version while Offline - Given the candidate "grails" version "2.1.0" is already installed and default - And the candidate "grails" version "1.3.9" is already installed but not default - And the system is bootstrapped - When I enter "sdk use grails" - Then I see "Using grails version 2.1.0 in this shell." - Scenario: Use the default candidate version when non selected while Offline Given the candidate "grails" version "1.3.9" is already installed but not default And the candidate "grails" version "2.1.0" is already installed but not default And the system is bootstrapped When I enter "sdk use grails" - Then I see "This command is not available while offline." + Then I see "No candidate version provided." Scenario: Use an uninstalled candidate version while Offline Given the candidate "grails" version "1.3.9" is already installed and default diff --git a/src/test/cucumber/use_version.feature b/src/test/cucumber/use_version.feature index d3881357..eda74180 100644 --- a/src/test/cucumber/use_version.feature +++ b/src/test/cucumber/use_version.feature @@ -22,18 +22,9 @@ Feature: Use Version Scenario: Use a candidate version that is not installed Given the candidate "grails" version "1.3.9" is available for download And the system is bootstrapped - When I enter "sdk use grails 1.3.9" and answer "Y" - Then I see "Using grails version 1.3.9 in this shell." - And the candidate "grails" version "1.3.9" should be in use - - Scenario: Use a candidate version that is automatically installed - Given I have configured "sdkman_auto_answer" to "true" - And the candidate "grails" version "1.3.9" is available for download - And the system is bootstrapped When I enter "sdk use grails 1.3.9" Then I see "Stop! grails 1.3.9 is not installed." - Then I see "Using grails version 1.3.9 in this shell." - And the candidate "grails" version "1.3.9" should be in use + And the exit code is 1 Scenario: Use a candidate version that does not exist Given the candidate "groovy" version "1.9.9" is not available for download @@ -48,26 +39,6 @@ Feature: Use Version When I enter "sdk use grails 2.0.0.M1" Then I see "Using grails version 2.0.0.M1 in this shell." - Scenario: Use an uninstalled candidate version of an uninstalled candidate and it becomes default - Given the candidate "grails" version "1.3.9" is available for download - And the candidate "grails" does not exist locally - And the system is bootstrapped - When I enter "sdk use grails 1.3.9" and answer "Y" - Then I see "Setting grails version 1.3.9 as default." - And I see "Using grails version 1.3.9 in this shell." - And the candidate "grails" version "1.3.9" is installed - And the candidate "grails" version "1.3.9" should be the default - - Scenario: Use an uninstalled candidate version of an installed candidate and it does not become default - Given the candidate "grails" version "1.3.9" is already installed and default - And the candidate "grails" version "2.1.0" is available for download - And the system is bootstrapped - When I enter "sdk use grails 2.1.0" and answer "Y" - Then I do not see "Setting grails version 1.3.9 as default." - And I see "Using grails version 2.1.0 in this shell." - And the candidate "grails" version "2.1.0" is installed - And the candidate "grails" version "1.3.9" should be the default - #scenarios related to updating _HOME variable Scenario: Use an installed version of an installed candidate updates the candidate _HOME variable @@ -79,20 +50,3 @@ Feature: Use Version When I enter "sdk use grails 2.1.0" And I see "Using grails version 2.1.0 in this shell." Then the "GRAILS_HOME" variable contains "grails/2.1.0" - - Scenario: Use an uninstalled version of an uninstalled candidate updates the candidate _HOME variable - Given the candidate "grails" does not exist locally - And the candidate "grails" version "2.1.0" is available for download - And the system is bootstrapped - And the "GRAILS_HOME" variable is not set - When I enter "sdk use grails 2.1.0" and answer "Y" - Then the "GRAILS_HOME" variable contains "grails/2.1.0" - - Scenario: Use an uninstalled version of an installed candidate updates the candidate _HOME variable - Given the candidate "grails" version "1.3.9" is already installed and default - And the candidate "grails" version "2.1.0" is available for download - And the system is bootstrapped - And the "GRAILS_HOME" variable contains "grails/current" - When I enter "sdk use grails 2.1.0" and answer "Y" - Then the "GRAILS_HOME" variable contains "grails/2.1.0" -