Disable candidate list when offline.

This commit is contained in:
Marco Vermeulen
2015-12-30 00:42:58 +00:00
parent 3a22cf241e
commit 983fb92b91
2 changed files with 11 additions and 2 deletions

View File

@@ -68,7 +68,11 @@ function __sdkman_list {
}
function __sdkman_list_candidates {
echo "$(curl -s "${SDKMAN_SERVICE}/candidates/list")" | ${PAGER-less}
if [[ "${SDKMAN_AVAILABLE}" == "false" ]]; then
echo "This command is not available while offline."
else
echo "$(curl -s "${SDKMAN_SERVICE}/candidates/list")" | ${PAGER-less}
fi
}
function __sdkman_list_versions {

View File

@@ -4,7 +4,7 @@ Feature: Service Unavailable
Given the internet is not reachable
And an initialised environment
# list command
# list commands
Scenario: List candidate versions found while Offline
Given the candidate "grails" version "2.1.0" is already installed and default
@@ -21,6 +21,11 @@ Feature: Service Unavailable
Then I see "Offline: only showing installed grails versions"
And I see "None installed!"
Scenario: List Available Candidates while Offline
Given the system is bootstrapped
When I enter "sdk list"
Then I see "This command is not available while offline."
# use command
Scenario: Use the default candidate version while Offline