-
Notifications
You must be signed in to change notification settings - Fork 4
/
_formatted_output.sh
59 lines (49 loc) · 1.59 KB
/
_formatted_output.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
#
# Formatted output file (Markdown format) helper
#
# You can find more bash utility / helper scripts at [https://github.com/bitrise-io/steps-utils-bash-toolkit](https://github.com/bitrise-io/steps-utils-bash-toolkit)
#
formatted_output_file_path="$BITRISE_STEP_FORMATTED_OUTPUT_FILE_PATH"
#
# Writes a single line into the Formatted Output
# param 1: the text to write
# param 2: if not zero then the given text will be printed to stdout too
function echo_string_to_formatted_output {
print_msg=$1
is_dont_print_to_std_out=$2
echo "${print_msg}" >> ${formatted_output_file_path}
if [ -z ${is_dont_print_to_std_out} ]; then
echo "${print_msg}"
fi
}
#
# Writes a markdown section (empty-line, text, empty-line) Formatted Output
# param 1: the text to write
# param 2: if not zero then the given text will be printed to stdout too
function write_section_to_formatted_output {
print_msg=$1
is_dont_print_to_std_out=$2
echo '' >> ${formatted_output_file_path}
echo "${print_msg}" >> ${formatted_output_file_path}
echo '' >> ${formatted_output_file_path}
if [ -z ${is_dont_print_to_std_out} ]; then
echo ''
echo "${print_msg}"
echo ''
fi
}
#
# Writes a markdown section start (text, empty-line) Formatted Output
# param 1: the text to write
# param 2: if not zero then the given text will be printed to stdout too
function write_section_start_to_formatted_output {
print_msg=$1
is_dont_print_to_std_out=$2
echo "${print_msg}" >> ${formatted_output_file_path}
echo '' >> ${formatted_output_file_path}
if [ -z ${is_dont_print_to_std_out} ]; then
echo "${print_msg}"
echo ''
fi
}