extract_utils: Introduce colored echo helper function
Change-Id: I25db42087232c646525f281cc0a1404fe60d1c8c
This commit is contained in:
@@ -1783,3 +1783,24 @@ function generate_prop_list_from_image() {
|
||||
# Clean-up
|
||||
rm -f "$output_list_tmp"
|
||||
}
|
||||
|
||||
function colored_echo() {
|
||||
IFS=" "
|
||||
local color=$1;
|
||||
shift
|
||||
if ! [[ $color =~ '^[0-9]$' ]] ; then
|
||||
case $(echo $color | tr '[:upper:]' '[:lower:]') in
|
||||
black) color=0 ;;
|
||||
red) color=1 ;;
|
||||
green) color=2 ;;
|
||||
yellow) color=3 ;;
|
||||
blue) color=4 ;;
|
||||
magenta) color=5 ;;
|
||||
cyan) color=6 ;;
|
||||
white|*) color=7 ;; # white or invalid color
|
||||
esac
|
||||
fi
|
||||
tput setaf $color
|
||||
printf '%s\n' "$*"
|
||||
tput sgr0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user