Skip to content

Commit

Permalink
replace tput with a safe_tput function (#129)
Browse files Browse the repository at this point in the history
* replaces tput with a safe_tput function
allows tput to be used on systems that support it but does not error if tput is not available

* add a git push after the sage theme is built and installed
we're unnecessarily waiting because we never actually pushed anything

* remove ||
  • Loading branch information
jazzsequence committed Jul 31, 2024
1 parent ba38f67 commit d892b44
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions private/scripts/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@
set -o pipefail
IFS=$'\n\t'

# Defines some global variables for colors.
normal=$(tput sgr0)
bold=$(tput bold)
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
# Function to safely call tput
safe_tput() {
tput "$@" 2>/dev/null
}

# Defines some global variables for colors with fallback values.
normal=$(safe_tput sgr0)
bold=$(safe_tput bold)
red=$(safe_tput setaf 1)
green=$(safe_tput setaf 2)
yellow=$(safe_tput setaf 3)
# Additional styles we aren't currently using.
# italic=$(tput sitm)
#blue=$(tput setaf 4)
#magenta=$(tput setaf 5)
#cyan=$(tput setaf 6)
#italic=$(safe_tput sitm)
#blue=$(safe_tput setaf 4)
#magenta=$(safe_tput setaf 5)
#cyan=$(safe_tput setaf 6)

# Use environment variables if set, otherwise prompt for input
sitename="${SITENAME:-}"
Expand Down Expand Up @@ -313,6 +318,7 @@ function install_sage_theme() {
# Commit the theme
git add "$sagedir"
git commit -m "[Sage Install] Add the Sage theme ${sagename}."
git push
echo "${green}Sage installed!${normal}"
}

Expand Down

0 comments on commit d892b44

Please sign in to comment.