split out the lib

This commit is contained in:
Earl Warren 2023-10-11 18:05:11 +02:00
parent 95aee3f580
commit 5f8f262472
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
5 changed files with 508 additions and 58 deletions

52
cascading-pr-lib.sh Normal file
View 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%%/}
}