mirror of
https://code.forgejo.org/actions/cascading-pr.git
synced 2025-06-28 04:43:44 +00:00
split out the lib
This commit is contained in:
parent
95aee3f580
commit
5f8f262472
5 changed files with 508 additions and 58 deletions
52
cascading-pr-lib.sh
Normal file
52
cascading-pr-lib.sh
Normal file
|
@ -0,0 +1,52 @@
|
|||
# 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%%/}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue