plugin-add: argument validation

This commit is contained in:
Laurens Duijvesteijn 2016-07-03 13:11:40 +02:00
parent 1589a03678
commit f9572739f6

View File

@ -1,4 +1,9 @@
plugin_add_command() {
if [ "$#" -ne 2 ]; then
display_error "usage: asdf plugin-add <name> <git-url>"
exit 1
fi
local plugin_name=$1
local source_url=$2
local plugin_path=$(get_plugin_path $plugin_name)
@ -6,7 +11,7 @@ plugin_add_command() {
mkdir -p $(asdf_dir)/plugins
if [ -d $plugin_path ]; then
echo "Plugin named $plugin_name already added"
display_error "Plugin named $plugin_name already added"
exit 1
else
git clone $source_url $plugin_path