2015-05-17 11:20:51 -07:00
|
|
|
plugin_add_command() {
|
2016-07-03 04:11:40 -07:00
|
|
|
if [ "$#" -ne 2 ]; then
|
|
|
|
display_error "usage: asdf plugin-add <name> <git-url>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-05-26 23:43:26 -07:00
|
|
|
local plugin_name=$1
|
2015-05-17 11:20:51 -07:00
|
|
|
local source_url=$2
|
2015-05-26 23:43:26 -07:00
|
|
|
local plugin_path=$(get_plugin_path $plugin_name)
|
2015-05-17 11:20:51 -07:00
|
|
|
|
2015-05-17 11:32:57 -07:00
|
|
|
mkdir -p $(asdf_dir)/plugins
|
2015-06-15 05:59:27 -07:00
|
|
|
|
|
|
|
if [ -d $plugin_path ]; then
|
2016-07-03 04:11:40 -07:00
|
|
|
display_error "Plugin named $plugin_name already added"
|
2016-05-13 00:04:01 -07:00
|
|
|
exit 1
|
2015-06-15 05:59:27 -07:00
|
|
|
else
|
|
|
|
git clone $source_url $plugin_path
|
2017-02-11 18:46:34 -07:00
|
|
|
if [ ! $? -eq 0 ]; then
|
2016-05-13 00:04:01 -07:00
|
|
|
exit 1
|
2015-06-15 05:59:27 -07:00
|
|
|
fi
|
2015-05-17 11:20:51 -07:00
|
|
|
fi
|
|
|
|
}
|