ci: Update the ci_verify_*.sh scripts.

Bring the coding patterns in line with the newest scripts.
This commit is contained in:
Cosmin Truta 2024-02-10 16:45:26 +02:00
parent c6ee62af2e
commit 7a6148290f
3 changed files with 24 additions and 18 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2024 Cosmin Truta. # Copyright (c) 2019-2024 Cosmin Truta.
# #
@ -181,8 +181,9 @@ function ci_build {
} }
function usage { function usage {
echo "usage: $CI_SCRIPT_NAME" echo "usage: $CI_SCRIPT_NAME [<options>]"
exit 0 echo "options: -?|-h|--help"
exit "${@:-0}"
} }
function main { function main {
@ -190,7 +191,7 @@ function main {
while getopts ":" opt while getopts ":" opt
do do
# This ain't a while-loop. It only pretends to be. # This ain't a while-loop. It only pretends to be.
[[ $1 == -[?h]* || $1 == --help ]] && usage [[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
ci_err "unknown option: '$1'" ci_err "unknown option: '$1'"
done done
shift $((OPTIND - 1)) shift $((OPTIND - 1))
@ -198,8 +199,9 @@ function main {
ci_init_build ci_init_build
ci_trace_build ci_trace_build
[[ $# -eq 0 ]] || { [[ $# -eq 0 ]] || {
ci_info "note: this program accepts environment options only" echo >&2 "error: unexpected argument: '$1'"
ci_err "unexpected argument: '$1'" echo >&2 "note: this program accepts environment options only"
usage 2
} }
ci_cleanup_old_build ci_cleanup_old_build
ci_build ci_build

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2024 Cosmin Truta. # Copyright (c) 2019-2024 Cosmin Truta.
# #
@ -134,8 +134,9 @@ function ci_build {
} }
function usage { function usage {
echo "usage: $CI_SCRIPT_NAME" echo "usage: $CI_SCRIPT_NAME [<options>]"
exit 0 echo "options: -?|-h|--help"
exit "${@:-0}"
} }
function main { function main {
@ -143,7 +144,7 @@ function main {
while getopts ":" opt while getopts ":" opt
do do
# This ain't a while-loop. It only pretends to be. # This ain't a while-loop. It only pretends to be.
[[ $1 == -[?h]* || $1 == --help ]] && usage [[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
ci_err "unknown option: '$1'" ci_err "unknown option: '$1'"
done done
shift $((OPTIND - 1)) shift $((OPTIND - 1))
@ -151,8 +152,9 @@ function main {
ci_init_build ci_init_build
ci_trace_build ci_trace_build
[[ $# -eq 0 ]] || { [[ $# -eq 0 ]] || {
ci_info "note: this program accepts environment options only" echo >&2 "error: unexpected argument: '$1'"
ci_err "unexpected argument: '$1'" echo >&2 "note: this program accepts environment options only"
usage 2
} }
ci_cleanup_old_build ci_cleanup_old_build
ci_build ci_build

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2024 Cosmin Truta. # Copyright (c) 2019-2024 Cosmin Truta.
# #
@ -141,8 +141,9 @@ function ci_build {
} }
function usage { function usage {
echo "usage: $CI_SCRIPT_NAME" echo "usage: $CI_SCRIPT_NAME [<options>]"
exit 0 echo "options: -?|-h|--help"
exit "${@:-0}"
} }
function main { function main {
@ -150,7 +151,7 @@ function main {
while getopts ":" opt while getopts ":" opt
do do
# This ain't a while-loop. It only pretends to be. # This ain't a while-loop. It only pretends to be.
[[ $1 == -[?h]* || $1 == --help ]] && usage [[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
ci_err "unknown option: '$1'" ci_err "unknown option: '$1'"
done done
shift $((OPTIND - 1)) shift $((OPTIND - 1))
@ -158,8 +159,9 @@ function main {
ci_init_build ci_init_build
ci_trace_build ci_trace_build
[[ $# -eq 0 ]] || { [[ $# -eq 0 ]] || {
ci_info "note: this program accepts environment options only" echo >&2 "error: unexpected argument: '$1'"
ci_err "unexpected argument: '$1'" echo >&2 "note: this program accepts environment options only"
usage 2
} }
ci_cleanup_old_build ci_cleanup_old_build
ci_build ci_build