From f0bcdc62c2a8e6241321cafc339803a29a4226b2 Mon Sep 17 00:00:00 2001 From: Archimedes Trajano Date: Sun, 29 Sep 2024 05:14:15 -0400 Subject: [PATCH] chore(install): allow specifying the version --- website/static/install.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/website/static/install.sh b/website/static/install.sh index d11683fb..9dc8770e 100755 --- a/website/static/install.sh +++ b/website/static/install.sh @@ -3,6 +3,7 @@ install_dir="" themes_dir="" executable="" +version="" error() { printf "\e[31m$1\e[0m\n" @@ -21,15 +22,16 @@ help() { # Display Help echo "Install script for Oh My Posh" echo - echo "Syntax: install.sh [-h|d|t]" + echo "Syntax: install.sh [-h] [-d ] [-t ] [-v ]" echo "options:" echo "-h Print this help." echo "-d Specify the installation directory. Defaults to $HOME/bin, $HOME/.local/bin or the directory where oh-my-posh is installed." echo "-t Specify the themes installation directory. Defaults to the oh-my-posh cache directory." + echo "-v Version to download, defaults to latest" echo } -while getopts ":hd:t:" option; do +while getopts ":hd:t:v:" option; do case $option in h) # display Help help @@ -38,6 +40,8 @@ while getopts ":hd:t:" option; do install_dir=${OPTARG};; t) # themes directory themes_dir=${OPTARG};; + v) # version + version=${OPTARG};; \?) # Invalid option echo "Invalid option command line option. Use -h for help." exit 1 @@ -188,6 +192,9 @@ install() { executable=${install_dir}/oh-my-posh url=https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-${target} + if [ "$version" ]; then + url=https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/${version}/posh-${target} + fi info "⬇️ Downloading oh-my-posh from ${url}"