-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathoutput_funcs.sh
More file actions
56 lines (52 loc) · 884 Bytes
/
output_funcs.sh
File metadata and controls
56 lines (52 loc) · 884 Bytes
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
46
47
48
49
50
51
52
53
54
55
56
# Outputs section heading
#
# Usage:
#
# output_section "Application tasks"
#
output_section() {
local indentation="----->"
echo "${indentation} $1"
}
# Outputs log line
#
# Usage:
#
# output_line "Cloning repository"
#
output_line() {
local spacing=" "
echo "${spacing} $1"
}
# Outputs a warning in red
#
# Usage:
#
# output_warning "Something went wrong"
#
output_warning() {
local spacing=" "
echo -e "${spacing} \e[31m$1\e[0m"
}
# Outputs to stderr for debugging
#
# Usage:
#
# output_stderr "Debug info"
#
output_stderr() {
# Outputs to stderr in case it is inside a function so it does not
# disturb the return value. Useful for debugging.
echo "$@" 1>&2;
}
# Pipe processor for indenting command output
#
# Usage:
#
# command | output_indent
#
output_indent() {
while read LINE; do
echo " $LINE" || true
done
}