diff --git a/ci/ci_verify_cmake.sh b/ci/ci_verify_cmake.sh index 9592d5840..05f140227 100755 --- a/ci/ci_verify_cmake.sh +++ b/ci/ci_verify_cmake.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -o errexit -o pipefail -o posix # Copyright (c) 2019-2024 Cosmin Truta. # @@ -181,8 +181,9 @@ function ci_build { } function usage { - echo "usage: $CI_SCRIPT_NAME" - exit 0 + echo "usage: $CI_SCRIPT_NAME []" + echo "options: -?|-h|--help" + exit "${@:-0}" } function main { @@ -190,7 +191,7 @@ function main { while getopts ":" opt do # 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'" done shift $((OPTIND - 1)) @@ -198,8 +199,9 @@ function main { ci_init_build ci_trace_build [[ $# -eq 0 ]] || { - ci_info "note: this program accepts environment options only" - ci_err "unexpected argument: '$1'" + echo >&2 "error: unexpected argument: '$1'" + echo >&2 "note: this program accepts environment options only" + usage 2 } ci_cleanup_old_build ci_build diff --git a/ci/ci_verify_configure.sh b/ci/ci_verify_configure.sh index 4a1307e88..8d124dea3 100755 --- a/ci/ci_verify_configure.sh +++ b/ci/ci_verify_configure.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -o errexit -o pipefail -o posix # Copyright (c) 2019-2024 Cosmin Truta. # @@ -134,8 +134,9 @@ function ci_build { } function usage { - echo "usage: $CI_SCRIPT_NAME" - exit 0 + echo "usage: $CI_SCRIPT_NAME []" + echo "options: -?|-h|--help" + exit "${@:-0}" } function main { @@ -143,7 +144,7 @@ function main { while getopts ":" opt do # 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'" done shift $((OPTIND - 1)) @@ -151,8 +152,9 @@ function main { ci_init_build ci_trace_build [[ $# -eq 0 ]] || { - ci_info "note: this program accepts environment options only" - ci_err "unexpected argument: '$1'" + echo >&2 "error: unexpected argument: '$1'" + echo >&2 "note: this program accepts environment options only" + usage 2 } ci_cleanup_old_build ci_build diff --git a/ci/ci_verify_makefiles.sh b/ci/ci_verify_makefiles.sh index d7ee11e99..9667d5366 100755 --- a/ci/ci_verify_makefiles.sh +++ b/ci/ci_verify_makefiles.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -o errexit -o pipefail -o posix # Copyright (c) 2019-2024 Cosmin Truta. # @@ -141,8 +141,9 @@ function ci_build { } function usage { - echo "usage: $CI_SCRIPT_NAME" - exit 0 + echo "usage: $CI_SCRIPT_NAME []" + echo "options: -?|-h|--help" + exit "${@:-0}" } function main { @@ -150,7 +151,7 @@ function main { while getopts ":" opt do # 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'" done shift $((OPTIND - 1)) @@ -158,8 +159,9 @@ function main { ci_init_build ci_trace_build [[ $# -eq 0 ]] || { - ci_info "note: this program accepts environment options only" - ci_err "unexpected argument: '$1'" + echo >&2 "error: unexpected argument: '$1'" + echo >&2 "note: this program accepts environment options only" + usage 2 } ci_cleanup_old_build ci_build