2019-11-27 01:24:29 -07:00
|
|
|
# -*- sh -*-
|
|
|
|
|
2015-05-17 11:20:51 -07:00
|
|
|
plugin_update_command() {
|
2019-11-30 14:00:58 -07:00
|
|
|
if [ "$#" -lt 1 ]; then
|
2019-11-30 13:08:52 -07:00
|
|
|
display_error "usage: asdf plugin-update {<name> | --all} [git-ref]"
|
2016-07-03 04:15:57 -07:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-11-30 13:08:52 -07:00
|
|
|
local plugin_name="$1"
|
|
|
|
local gitref="${2:-master}"
|
2015-05-20 21:31:09 -07:00
|
|
|
if [ "$plugin_name" = "--all" ]; then
|
2018-06-10 01:54:39 -07:00
|
|
|
for dir in "$(asdf_data_dir)"/plugins/*; do
|
2017-09-04 10:04:56 -07:00
|
|
|
echo "Updating $(basename "$dir")..."
|
2019-11-30 13:08:52 -07:00
|
|
|
(cd "$dir" && git fetch -p -u origin "$gitref:$gitref" && git checkout -f "$gitref")
|
2015-05-17 03:47:45 -07:00
|
|
|
done
|
2015-05-17 00:46:56 -07:00
|
|
|
else
|
2017-09-04 10:04:56 -07:00
|
|
|
local plugin_path
|
2019-11-30 13:08:52 -07:00
|
|
|
plugin_path="$(get_plugin_path "$plugin_name")"
|
2017-09-04 10:04:56 -07:00
|
|
|
check_if_plugin_exists "$plugin_name"
|
2015-05-20 21:31:09 -07:00
|
|
|
echo "Updating $plugin_name..."
|
2019-11-30 13:08:52 -07:00
|
|
|
(cd "$plugin_path" && git fetch -p -u origin "$gitref:$gitref" && git checkout -f "$gitref")
|
2015-05-17 00:46:56 -07:00
|
|
|
fi
|
|
|
|
}
|
2019-11-27 01:24:29 -07:00
|
|
|
|
|
|
|
plugin_update_command "$@"
|