From 3e80b4fa63c6dae1dfc23d763d7a2340c2bfb340 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 16 Sep 2021 08:43:48 +0200 Subject: [PATCH] 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. --- contrib/scripts/nm-code-format.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/scripts/nm-code-format.sh b/contrib/scripts/nm-code-format.sh index dcc85239d9..0f84c50dcf 100755 --- a/contrib/scripts/nm-code-format.sh +++ b/contrib/scripts/nm-code-format.sh @@ -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