mirror of
https://github.com/sdkman/sdkman-cli.git
synced 2026-05-24 16:42:24 -04:00
Make tweaks to presentation of update command.
This commit is contained in:
@@ -47,13 +47,19 @@ function __sdk_update {
|
||||
|
||||
local diff=$(echo ${fresh_candidates[@]} ${cached_candidates[@]} | tr ' ' '\n' | sort | uniq -u | tr '\n' ',')
|
||||
if (( fresh_candidates_length > cached_candidates_length )); then
|
||||
__sdkman_echo_yellow "New candidates(s) found: ${diff:0:-1}"
|
||||
echo ""
|
||||
__sdkman_echo_green "Adding new candidates(s): ${diff:0:-1}"
|
||||
echo "$fresh_candidates_csv" > "$SDKMAN_CANDIDATES_CACHE"
|
||||
echo ""
|
||||
__sdkman_echo_yellow "Please open a new terminal now..."
|
||||
|
||||
elif (( fresh_candidates_length < cached_candidates_length )); then
|
||||
local candidates_diff="${diff:0:-1}"
|
||||
__sdkman_echo_yellow "Retired candidates(s) removed: ${diff:0:-1}"
|
||||
echo ""
|
||||
__sdkman_echo_green "Removing obsolete candidates(s): ${diff:0:-1}"
|
||||
echo "$fresh_candidates_csv" > "$SDKMAN_CANDIDATES_CACHE"
|
||||
echo ""
|
||||
__sdkman_echo_yellow "Please open a new terminal now..."
|
||||
|
||||
else
|
||||
__sdkman_echo_green "No new candidates found at this time."
|
||||
|
||||
@@ -4,7 +4,7 @@ Feature: Update
|
||||
Given the internet is reachable
|
||||
And the following candidates are available for installation in local cache:
|
||||
| candidate |
|
||||
| ceylon |
|
||||
| activator |
|
||||
| groovy |
|
||||
| scala |
|
||||
And an initialised environment
|
||||
@@ -13,13 +13,13 @@ Feature: Update
|
||||
Scenario: A new candidate is available
|
||||
And the following candidates are currently available from remote API:
|
||||
| candidate |
|
||||
| ceylon |
|
||||
| activator |
|
||||
| groovy |
|
||||
| kotlin |
|
||||
| scala |
|
||||
When I enter "sdk update"
|
||||
Then I see "New candidates(s) found: kotlin"
|
||||
And the Candidates cache should contain "ceylon,groovy,kotlin,scala"
|
||||
Then I see "Adding new candidates(s): kotlin"
|
||||
And the Candidates cache should contain "activator,groovy,kotlin,scala"
|
||||
|
||||
Scenario: A candidate has been removed
|
||||
And the following candidates are currently available from remote API:
|
||||
@@ -27,17 +27,15 @@ Feature: Update
|
||||
| groovy |
|
||||
| scala |
|
||||
When I enter "sdk update"
|
||||
Then I see "Retired candidates(s) removed: ceylon"
|
||||
Then I see "Removing obsolete candidates(s): activator"
|
||||
And the Candidates cache should contain "groovy,scala"
|
||||
|
||||
Scenario: No new candidate is available
|
||||
And the following candidates are currently available from remote API:
|
||||
| candidate |
|
||||
| ceylon |
|
||||
| activator |
|
||||
| groovy |
|
||||
| scala |
|
||||
When I enter "sdk update"
|
||||
Then I see "No new candidates found at this time."
|
||||
And the Candidates cache should contain "ceylon,groovy,scala"
|
||||
|
||||
Scenario:
|
||||
And the Candidates cache should contain "activator,groovy,scala"
|
||||
@@ -23,7 +23,7 @@ class CandidatesCacheUpdateSpec extends SdkmanEnvSpecification {
|
||||
sdkmanBashEnvBuilder.withConfiguration("sdkman_debug_mode", "true")
|
||||
}
|
||||
|
||||
void "should issue a warning if cache is empty"() {
|
||||
void "should issue a warning and escape if cache is empty"() {
|
||||
given:
|
||||
bash = sdkmanBashEnvBuilder
|
||||
.withCandidates([])
|
||||
@@ -106,7 +106,7 @@ class CandidatesCacheUpdateSpec extends SdkmanEnvSpecification {
|
||||
bash.execute("sdk update")
|
||||
|
||||
then:
|
||||
bash.output.contains('New candidates(s) found: groovy,scala')
|
||||
bash.output.contains('Adding new candidates(s): groovy,scala')
|
||||
|
||||
and:
|
||||
candidatesCache.text.trim() == "groovy,scala"
|
||||
|
||||
Reference in New Issue
Block a user