mirror of
https://github.com/sdkman/sdkman-cli.git
synced 2026-02-01 02:03:18 -05:00
Add 'current' command to show version in use.
This commit is contained in:
@@ -24,3 +24,16 @@ Feature: Use Candidate
|
||||
And the candidate "grails" version "1.3.9" is in use
|
||||
When I enter "gvm use grails 2.1.0"
|
||||
Then the candidate "grails" version "2.1.0" should be in use
|
||||
|
||||
Scenario: Display current candidate version in use
|
||||
Given the candidate "grails" version "2.1.0" is already installed
|
||||
Given the candidate "grails" version "1.3.9" is already installed
|
||||
And the candidate "grails" version "1.3.9" is in use
|
||||
When I enter "gvm current grails"
|
||||
Then I see "Using grails version 1.3.9"
|
||||
|
||||
Scenario: Display current candidate version when none is in use
|
||||
Given the candidate "grails" version "2.1.0" is already installed
|
||||
Given the candidate "grails" version "1.3.9" is already installed
|
||||
When I enter "gvm current grails"
|
||||
Then I see "Not using any version of grails"
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import static cucumber.runtime.groovy.Hooks.*
|
||||
import static gvm.VertxUtils.*
|
||||
|
||||
def gvmDir = System.getenv('GVM_DIR')
|
||||
if (!gvmDir) {
|
||||
throw new RuntimeException("You must have the GVM_DIR environment variable set to run the tests")
|
||||
}
|
||||
|
||||
gvmDir = new File(System.getenv('GVM_DIR'))
|
||||
|
||||
server = null
|
||||
|
||||
@@ -11,7 +11,7 @@ function help {
|
||||
echo ""
|
||||
echo "Usage: gvm <command> <candidate> [version]"
|
||||
echo ""
|
||||
echo " command : install, uninstall, list, use, selfupdate or help"
|
||||
echo " command : install, uninstall, list, use, current, selfupdate or help"
|
||||
echo " candidate : $CANDIDATES"
|
||||
echo " version : optional, defaults to latest stable if not provided"
|
||||
echo ""
|
||||
@@ -139,7 +139,7 @@ if [ "$1" == "help" -o -z "$1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" != "install" -a "$1" != "use" -a "$1" != "uninstall" -a "$1" != "list" -a "$1" != "help" -a "$1" != "selfupdate" ]; then
|
||||
if [ "$1" != "install" -a "$1" != "use" -a "$1" != "uninstall" -a "$1" != "list" -a "$1" != "current" -a "$1" != "help" -a "$1" != "selfupdate" ]; then
|
||||
echo -e "\nInvalid command: $1"
|
||||
help
|
||||
exit 0
|
||||
@@ -189,6 +189,16 @@ function gvm-use {
|
||||
echo Using "$CANDIDATE" version "$VERSION"
|
||||
}
|
||||
|
||||
function gvm-current {
|
||||
CANDIDATE="$1"
|
||||
determine_current_version "$CANDIDATE"
|
||||
if [ -n "$CURRENT" ]; then
|
||||
echo Using "$CANDIDATE" version "$CURRENT"
|
||||
else
|
||||
echo Not using any version of "$CANDIDATE"
|
||||
fi
|
||||
}
|
||||
|
||||
function gvm-list {
|
||||
CANDIDATE="$1"
|
||||
check_candidate_present "$CANDIDATE"
|
||||
|
||||
Reference in New Issue
Block a user