mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Add update command.
This commit is contained in:
parent
7c2514d93b
commit
492ea04cc0
28
lib/commands/update.sh
Normal file
28
lib/commands/update.sh
Normal file
@ -0,0 +1,28 @@
|
||||
update_command() {
|
||||
local update_to_head=$1
|
||||
|
||||
(
|
||||
cd $(asdf_dir)
|
||||
pwd
|
||||
|
||||
if [ "$update_to_head" = "--head" ]; then
|
||||
# Update to latest on the master branch
|
||||
git checkout master || exit 1
|
||||
|
||||
# Pull down the latest changes on master
|
||||
git pull origin master || exit 1
|
||||
echo "Updated asdf to latest on the master branch"
|
||||
else
|
||||
# Update to latest release
|
||||
git fetch --tags || exit 1
|
||||
tags=$(git tag)
|
||||
|
||||
# Pick the newest tag
|
||||
tag=$()
|
||||
|
||||
# Update
|
||||
git checkout "$tag" || exit 1
|
||||
echo "Updated asdf to release $tag"
|
||||
fi
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user