mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 09:38:16 -07:00
Add which command
This commit is contained in:
parent
af4784e516
commit
d037628e7e
4
bin/asdf
4
bin/asdf
@ -5,6 +5,7 @@ source $(dirname $(dirname $0))/lib/utils.sh
|
|||||||
source $(dirname $(dirname $0))/lib/commands/help.sh
|
source $(dirname $(dirname $0))/lib/commands/help.sh
|
||||||
source $(dirname $(dirname $0))/lib/commands/install.sh
|
source $(dirname $(dirname $0))/lib/commands/install.sh
|
||||||
source $(dirname $(dirname $0))/lib/commands/uninstall.sh
|
source $(dirname $(dirname $0))/lib/commands/uninstall.sh
|
||||||
|
source $(dirname $(dirname $0))/lib/commands/which.sh
|
||||||
source $(dirname $(dirname $0))/lib/commands/list.sh
|
source $(dirname $(dirname $0))/lib/commands/list.sh
|
||||||
source $(dirname $(dirname $0))/lib/commands/list-all.sh
|
source $(dirname $(dirname $0))/lib/commands/list-all.sh
|
||||||
source $(dirname $(dirname $0))/lib/commands/reshim.sh
|
source $(dirname $(dirname $0))/lib/commands/reshim.sh
|
||||||
@ -31,6 +32,9 @@ case $1 in
|
|||||||
"uninstall")
|
"uninstall")
|
||||||
uninstall_command $callback_args;;
|
uninstall_command $callback_args;;
|
||||||
|
|
||||||
|
"which")
|
||||||
|
which_command $callback_args;;
|
||||||
|
|
||||||
"list")
|
"list")
|
||||||
list_command $callback_args;;
|
list_command $callback_args;;
|
||||||
|
|
||||||
|
15
lib/commands/which.sh
Normal file
15
lib/commands/which.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
which_command() {
|
||||||
|
local plugin_name=$1
|
||||||
|
local plugin_path=$(get_plugin_path $plugin_name)
|
||||||
|
check_if_plugin_exists $plugin_path
|
||||||
|
|
||||||
|
full_version=$(get_preset_version_for $plugin_name)
|
||||||
|
|
||||||
|
if [ "$full_version" == "" ]; then
|
||||||
|
echo "No version set for ${plugin_name}"
|
||||||
|
exit -1
|
||||||
|
else
|
||||||
|
echo "$full_version"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user