xref: /aosp_15_r20/external/libbpf/ci/vmtest/helpers.sh (revision f7c14bbac8cf49633f2740db462ea43457973ec4)
1# shellcheck shell=bash
2
3# $1 - start or end
4# $2 - fold identifier, no spaces
5# $3 - fold section description
6foldable() {
7  local YELLOW='\033[1;33m'
8  local NOCOLOR='\033[0m'
9  if [ $1 = "start" ]; then
10    line="::group::$2"
11    if [ ! -z "${3:-}" ]; then
12      line="$line - ${YELLOW}$3${NOCOLOR}"
13    fi
14  else
15    line="::endgroup::"
16  fi
17  echo -e "$line"
18}
19
20__print() {
21  local TITLE=""
22  if [[ -n $2 ]]; then
23      TITLE=" title=$2"
24  fi
25  echo "::$1${TITLE}::$3"
26}
27
28# $1 - title
29# $2 - message
30print_error() {
31  __print error $1 $2
32}
33
34# $1 - title
35# $2 - message
36print_notice() {
37  __print notice $1 $2
38}
39