From 00ac0ad44d6cf9f8f51c5644005cdc6e3320bf1f Mon Sep 17 00:00:00 2001 From: phenonymous <29523105+phenonymous@users.noreply.github.com> Date: Sat, 1 Dec 2018 18:06:39 +0100 Subject: [PATCH] Change progressbar url to raw release --- gogh.sh | 8 ++++++-- test/print-themes.sh | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gogh.sh b/gogh.sh index a6b3cf0..aece45f 100755 --- a/gogh.sh +++ b/gogh.sh @@ -183,6 +183,7 @@ declare -a THEMES=( # Allow developer to change url to forked url for easier testing BASE_URL=${BASE_URL:-"https://raw.githubusercontent.com/Mayccoll/Gogh/master"} +PROGRESS_URL="https://raw.githubusercontent.com/phenonymous/shell-progressbar/1.0/progress.sh" capitalize() { local ARGUMENT=$1 @@ -329,10 +330,11 @@ fi # | ::::::: Fancy progressbar for lengthy operations # | if [[ ${#OPTION[@]} -gt 5 ]]; then + # Note: We use eval here because we want the functions to be available in this script if [[ "$(uname)" = "Darwin" ]]; then - eval "$(curl -sLo- https://git.io/progressbar)" 2> /dev/null + eval "$(curl -so- ${PROGRESS_URL})" 2> /dev/null else - eval "$(wget -qO- https://git.io/progressbar)" 2> /dev/null + eval "$(wget -qO- ${PROGRESS_URL})" 2> /dev/null fi fi @@ -410,4 +412,6 @@ for OP in "${OPTION[@]#0}"; do exit 1 fi done +# If you skip || : and the command does not exist the script will exit with code 1 +# this will always return exit code 0 if we got this far command -v bar::stop > /dev/null && bar::stop || : diff --git a/test/print-themes.sh b/test/print-themes.sh index 95cb2c2..fed6883 100755 --- a/test/print-themes.sh +++ b/test/print-themes.sh @@ -203,7 +203,9 @@ declare -a THEMES=( ) # Allow developer to change url to forked url for easier testing +# IMPORTANT: Make sure you export this variable if your main shell is not bash BASE_URL=${BASE_URL:-"https://raw.githubusercontent.com/Mayccoll/Gogh/master"} +PROGRESS_URL="https://raw.githubusercontent.com/phenonymous/shell-progressbar/1.0/progress.sh" capitalize() { local ARGUMENT=$1 @@ -243,10 +245,11 @@ remove_file_extension (){ } # Fancy progress bar +# Note: We use eval here because we want the functions to be available in this script if [[ "$(uname)" = "Darwin" ]]; then - eval "$(curl -sLo- https://git.io/progressbar)" 2> /dev/null + eval "$(curl -so- ${PROGRESS_URL})" 2> /dev/null else - eval "$(wget -qO- https://git.io/progressbar)" 2> /dev/null + eval "$(wget -qO- ${PROGRESS_URL})" 2> /dev/null fi declare color_dot_str