Skip to content

Commit

Permalink
[bcgov#197] Coloured output does display on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
tdiesler committed Mar 18, 2022
1 parent 92e4960 commit a6cf54f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions manage
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,12 @@ function findBackup(){
)
}

# OSX ships with an old version of Bash that does not support the \e escape character.
function echoYellow (){
(
_msg=${1}
_yellow='\e[33m'
_nc='\e[0m' # No Color
_yellow='\x1B[33m'
_nc='\x1B[0m' # No Color
echo -e "${_yellow}${_msg}${_nc}" >&2
)
}
Expand All @@ -674,7 +675,7 @@ function promptForConfirmation(){
(
_msg=${@}
echoYellow "\n${_msg}"
read -n1 -s -r -p $'\e[33mWould you like to continue?\e[0m Press \'Y\' to continue, or any other key to exit ...\n' key
read -n1 -s -r -p $'\x1B[33mWould you like to continue?\x1B[0m Press \'Y\' to continue, or any other key to exit ...\n' key
if [[ $(toLower ${key}) == 'y' ]]; then
return 0
else
Expand Down

0 comments on commit a6cf54f

Please sign in to comment.