Created
June 15, 2024 15:21
-
-
Save cnunciato/c7e41b4dc9626aa42532b4d694afaad4 to your computer and use it in GitHub Desktop.
Switch between Hugo versions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use_hugo() { | |
local VERSION="$1" | |
local TARFILE="hugo_${VERSION}_darwin-universal.tar.gz" | |
local TEMP_DIR="${HOME}/Downloads/hugo_temp" | |
local DESTFILE="${TEMP_DIR}/$TARFILE" | |
mkdir -p "$TEMP_DIR" | |
curl -L -o "$DESTFILE" "https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${TARFILE}" && \ | |
tar -xzvf "$DESTFILE" -C "$TEMP_DIR" && \ | |
sudo mv "${TEMP_DIR}/hugo" "/usr/local/bin/" && \ | |
rm -rf "$DESTFILE" "$TEMP_DIR" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ use_hugo 0.111.0 | |
hugo v0.111.0-3fa8bb8318114cd69315eadd35bda169e6a8ca4b darwin/arm64 BuildDate=2023-03-01T20:57:44Z VendorInfo=gohugoio | |
$ use_hugo 0.126.0 | |
hugo v0.126.0-32c967551be308fbd14e5f0dfba0ff50a60e7f5e darwin/arm64 BuildDate=2024-05-14T13:24:11Z VendorInfo=gohugoio |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment