Add which command

This commit is contained in:
Akash Manohar J 2015-05-27 12:13:10 +05:30
parent af4784e516
commit d037628e7e
2 changed files with 19 additions and 0 deletions

View File

@ -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;;

15
lib/commands/which.sh Normal file
View 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
}