contrib: reformat by default from "nm-code-format.sh" script

The majority of times when I call this script, I want it to do the reformatting,
not the check-only mode. This is also because we use git, so I start with a
clean working directory and run the reformatting code. In the best case, there
is nothing to reformat, and all is good. I seldom want to only check.

Change the default of the script.
This commit is contained in:
Thomas Haller 2021-09-16 08:43:48 +02:00
parent 82a6f2c465
commit 3e80b4fa63
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -46,7 +46,7 @@ fi
FILES=()
HAS_EXPLICIT_FILES=0
SHOW_FILENAMES=0
TEST_ONLY=1
TEST_ONLY=0
usage() {
printf "Usage: %s [OPTION]... [FILE]...\n" "$(basename "$0")"
@ -54,10 +54,10 @@ usage() {
printf "If no file is given the script runs on the whole codebase.\n"
printf "If no flag is given no file is touch but errors are reported.\n\n"
printf "OPTIONS:\n"
printf " -i Reformat files\n"
printf " -n Only check the files (this is the default)\n"
printf " -i Reformat files (this is the default)\n"
printf " -n|--dry-run Only check the files (contrary to \"-i\")\n"
printf " -h Print this help message\n"
printf " --show-filenames Only print the filenames that would be checked\n"
printf " --show-filenames Only print the filenames that would be checked/formatted\n"
printf " -- Separate options from filenames/directories\n"
}
@ -92,7 +92,7 @@ while (( $# )); do
shift
continue
;;
-n)
-n|--dry-run)
TEST_ONLY=1
shift
continue