#!/usr/bin/env bash

# usage: $0 <start|end> <section_identifier+config> "<human section name>"
# eg: $0 start 'my_section[collapsed=true]' "My collapsed section"
#
# See also: https://docs.gitlab.com/ee/ci/jobs/#custom-collapsible-sections
set -euo pipefail

if [ "$1" = start ]; then
	echo -e "\e[0Ksection_start:$(date +%s):$2\r\e[0K$3"
else
	echo -e "\e[0Ksection_end:$(date +%s):$2\r\e[0K"
fi
