Skip to content

Commit

Permalink
Merge pull request #78 from duijf/argument-validation. Thank you @duijf
Browse files Browse the repository at this point in the history
… ~!

Argument validation
  • Loading branch information
HashNuke committed Jul 3, 2016
2 parents 1589a03 + ccefa99 commit e962639
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/commands/plugin-add.sh
@@ -1,12 +1,17 @@
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)

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
Expand Down
5 changes: 5 additions & 0 deletions lib/commands/plugin-update.sh
@@ -1,4 +1,9 @@
plugin_update_command() {
if [ "$#" -ne 1 ]; then
display_error "usage: asdf plugin-update {<name> | --all}"
exit 1
fi

local plugin_name=$1
if [ "$plugin_name" = "--all" ]; then
for dir in $(asdf_dir)/plugins/*; do
Expand Down

0 comments on commit e962639

Please sign in to comment.