From: Tom de Vries Date: Mon, 21 Oct 2024 13:07:02 +0000 (+0200) Subject: [gdb/contrib] Add spellcheck.sh --check X-Git-Tag: gdb-16-branchpoint~623 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=84fbbb5e6140791dbb60f3897c5bac5e9c173780;p=thirdparty%2Fbinutils-gdb.git [gdb/contrib] Add spellcheck.sh --check Add a new option --check to gdb/contrib/spellcheck.sh, to do the spell check and bail out ASAP with an exit code of 1 if misspelled words were found, or 0 otherwise. Verified with shellcheck. --- diff --git a/gdb/contrib/spellcheck.sh b/gdb/contrib/spellcheck.sh index 4203333b846..3188734331c 100755 --- a/gdb/contrib/spellcheck.sh +++ b/gdb/contrib/spellcheck.sh @@ -76,7 +76,7 @@ sed_separator=$(join $sed_or "${sed_separators[@]}") usage () { - echo "usage: $(basename "$0") +" + echo "usage: $(basename "$0") [--check] +" } make_absolute () @@ -101,6 +101,18 @@ parse_args () files=$(mktemp) trap 'rm -f "$files"' EXIT + while true; do + case " $1 " in + " --check ") + check=true + shift + ;; + *) + break + ;; + esac + done + if [ $# -eq -0 ]; then usage exit 1 @@ -311,6 +323,7 @@ replace_word_in_files () main () { declare -a unique_files + check=false parse_args "$@" get_dictionary @@ -329,6 +342,10 @@ main () return fi + if $check; then + exit 1 + fi + declare -A words_done local i word replacement i=0