blob: 32ed234d9089f02781096c2ed3cc19258e62a73f [file] [log] [blame]
Ulya Trafimovich95977482021-11-09 14:05:14 +00001#! /bin/bash
2#
3# Copyright (C) 2021 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Utilities for buildbot. This script is sourced by other buildbot-*.sh scripts.
18
19if [ -t 1 ]; then
20 # Color sequences if terminal is a tty.
21
22 red='\033[0;31m'
23 green='\033[0;32m'
24 yellow='\033[0;33m'
25 blue='\033[0;34m'
26 magenta='\033[0;35m'
27 cyan='\033[0;36m'
28
29 boldred='\033[1;31m'
30 boldgreen='\033[1;32m'
31 boldyellow='\033[1;33m'
32 boldblue='\033[1;34m'
33 boldmagenta='\033[1;95m'
34 boldcyan='\033[1;36m'
35
36 nc='\033[0m'
37fi
Ulya Trafimovich5298bcd2021-11-09 14:46:22 +000038
39function msginfo() {
40 local heading="$1"
41 shift
42 local message="$*"
43 echo -e "${green}${heading}${nc} ${message}"
44}
45
46function msgwarning() {
47 local message="$*"
48 echo -e "${boldmagenta}Warning: ${nc}${message}"
49}
50
51function msgerror() {
52 local message="$*"
53 echo -e "${boldred}Error: ${nc}${message}"
54}
55
56function msgnote() {
57 local message="$*"
58 echo -e "${boldcyan}Note: ${nc}${message}"
59}