-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path_utils.sh
executable file
·45 lines (39 loc) · 1.21 KB
/
_utils.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2018
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
set -o errexit
set -o nounset
set -o pipefail
if [[ ${KRD_DEBUG:-false} == "true" ]]; then
set -o xtrace
fi
# debug() - This function prints a debug message in the standard output
function debug {
_print_msg "DEBUG" "$1"
echo "::debug::$1"
}
# info() - This function prints an information message in the standard output
function info {
_print_msg "INFO" "$1"
echo "::notice::$1"
}
# warn() - This function prints a warning message in the standard output
function warn {
_print_msg "WARN" "$1"
echo "::warning::$1"
}
# error() - This function prints an error message in the standard output
function error {
_print_msg "ERROR" "$1"
echo "::error::$1"
exit 1
}
function _print_msg {
echo "$(date +%H:%M:%S) - $1: $2"
}