logging.bash: Add dedcat and excat helpers

This commit is contained in:
Andrew Rogers 2023-06-21 23:51:03 -05:00
commit b4e2541e50
3 changed files with 5 additions and 4 deletions

View file

@ -1,3 +1,5 @@
errcho() { (>&2 echo $@); } errcho() { (>&2 echo $@); }
errcat() { (>&2 cat <<<"$@"); } errcat() { (>&2 cat <<<"$@"); }
dedcat() { (>&2 cat <<<"$@"); exit 1; }
excat() { (>&2 cat <<<"$@"); exit 0; }
die() { errcho $@; exit 1; } die() { errcho $@; exit 1; }

View file

@ -14,7 +14,7 @@ Usage: $0 BRANCH_A UPSTREAM_BRANCH [START_REFSPEC]
Note: Commit hashes are walked along UPSTREAM_BRANCH. Note: Commit hashes are walked along UPSTREAM_BRANCH.
EOUSAGE EOUSAGE
[ -z "$1" -o -z "$2" ] && errcat "$usage" && exit 1 [ -z "$1" -o -z "$2" ] && dedcat "$usage"
branch_a="$1" branch_a="$1"
upstream_branch="$2" upstream_branch="$2"

View file

@ -41,7 +41,7 @@ get-incl() {
cc=${CC:-cc} cc=${CC:-cc}
cxx=${CXX:-cxx} cxx=${CXX:-cxx}
[ -z "$1" ] && errcat "$usage" && exit 1 [ -z "$1" ] && dedcat "$usage"
case "$1" in case "$1" in
'clang') ;& 'clang') ;&
@ -72,8 +72,7 @@ while getopts 'cpP' opt; do
sort -u <<<$(get-both) sort -u <<<$(get-both)
;; ;;
*) *)
errcat "$usage" dedcat "$usage"
exit 1
;; ;;
esac esac
done done