diff --git a/bin/asdf b/bin/asdf index 995b3c9a..dd3ece7e 100755 --- a/bin/asdf +++ b/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/install.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-all.sh source $(dirname $(dirname $0))/lib/commands/reshim.sh @@ -31,6 +32,9 @@ case $1 in "uninstall") uninstall_command $callback_args;; +"which") + which_command $callback_args;; + "list") list_command $callback_args;; diff --git a/lib/commands/which.sh b/lib/commands/which.sh new file mode 100644 index 00000000..68fb22d1 --- /dev/null +++ b/lib/commands/which.sh @@ -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 +}