mirror of
https://code.forgejo.org/actions/cascading-pr.git
synced 2025-04-23 17:20:49 +00:00
53 lines
651 B
Bash
53 lines
651 B
Bash
|
# SPDX-License-Identifier: MIT
|
||
|
|
||
|
declare -A options
|
||
|
|
||
|
VERBOSE=false
|
||
|
DEBUG=false
|
||
|
: ${EXIT_ON_ERROR:=true}
|
||
|
|
||
|
function debug() {
|
||
|
DEBUG=true
|
||
|
set -x
|
||
|
PS4='${BASH_SOURCE[0]}:$LINENO: ${FUNCNAME[0]}: '
|
||
|
}
|
||
|
|
||
|
function verbose() {
|
||
|
VERBOSE=true
|
||
|
}
|
||
|
|
||
|
function log() {
|
||
|
echo "$@" >&2
|
||
|
}
|
||
|
|
||
|
function log_error() {
|
||
|
log "$@"
|
||
|
}
|
||
|
|
||
|
function log_verbose() {
|
||
|
if $VERBOSE ; then
|
||
|
log "$@"
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
function log_info() {
|
||
|
log "$@"
|
||
|
}
|
||
|
|
||
|
function fatal_error() {
|
||
|
log_error "$@"
|
||
|
if $EXIT_ON_ERROR ; then
|
||
|
exit 1
|
||
|
else
|
||
|
return 1
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
function host_port() {
|
||
|
local url="$1"
|
||
|
|
||
|
local host_port="${url##http*://}"
|
||
|
echo ${host_port%%/}
|
||
|
}
|
||
|
|