mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
chore(install): allow specifying the version
This commit is contained in:
parent
a7d73be1e7
commit
f0bcdc62c2
|
@ -3,6 +3,7 @@
|
||||||
install_dir=""
|
install_dir=""
|
||||||
themes_dir=""
|
themes_dir=""
|
||||||
executable=""
|
executable=""
|
||||||
|
version=""
|
||||||
|
|
||||||
error() {
|
error() {
|
||||||
printf "\e[31m$1\e[0m\n"
|
printf "\e[31m$1\e[0m\n"
|
||||||
|
@ -21,15 +22,16 @@ help() {
|
||||||
# Display Help
|
# Display Help
|
||||||
echo "Install script for Oh My Posh"
|
echo "Install script for Oh My Posh"
|
||||||
echo
|
echo
|
||||||
echo "Syntax: install.sh [-h|d|t]"
|
echo "Syntax: install.sh [-h] [-d <dir>] [-t <dir>] [-v <ver>]"
|
||||||
echo "options:"
|
echo "options:"
|
||||||
echo "-h Print this help."
|
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 "-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 "-t Specify the themes installation directory. Defaults to the oh-my-posh cache directory."
|
||||||
|
echo "-v Version to download, defaults to latest"
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts ":hd:t:" option; do
|
while getopts ":hd:t:v:" option; do
|
||||||
case $option in
|
case $option in
|
||||||
h) # display Help
|
h) # display Help
|
||||||
help
|
help
|
||||||
|
@ -38,6 +40,8 @@ while getopts ":hd:t:" option; do
|
||||||
install_dir=${OPTARG};;
|
install_dir=${OPTARG};;
|
||||||
t) # themes directory
|
t) # themes directory
|
||||||
themes_dir=${OPTARG};;
|
themes_dir=${OPTARG};;
|
||||||
|
v) # version
|
||||||
|
version=${OPTARG};;
|
||||||
\?) # Invalid option
|
\?) # Invalid option
|
||||||
echo "Invalid option command line option. Use -h for help."
|
echo "Invalid option command line option. Use -h for help."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -188,6 +192,9 @@ install() {
|
||||||
|
|
||||||
executable=${install_dir}/oh-my-posh
|
executable=${install_dir}/oh-my-posh
|
||||||
url=https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-${target}
|
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}"
|
info "⬇️ Downloading oh-my-posh from ${url}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue