diff --git a/Makefile b/Makefile index 186f9ab61906ea..93faed51da0b34 100644 --- a/Makefile +++ b/Makefile @@ -3416,6 +3416,11 @@ check-docs:: check-builtins:: ./check-builtins.sh +### Make sure all the usage strings follow usage string style guide +# +check-usage-strings:: + ./check-usage-strings.sh + ### Test suite coverage testing # .PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 28a2e6a5750b73..614d95b022c8f6 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1209,7 +1209,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) OPT_CMDMODE(0, "bisect-visualize", &cmdmode, N_("visualize the bisection"), BISECT_VISUALIZE), OPT_CMDMODE(0, "bisect-run", &cmdmode, - N_("use ... to automatically bisect."), BISECT_RUN), + N_("use ... to automatically bisect"), BISECT_RUN), OPT_BOOL(0, "no-log", &nolog, N_("no log for BISECT_WRITE")), OPT_END() diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index c5d3fc3817f599..9864ec1427d1b6 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1874,7 +1874,7 @@ static int module_clone(int argc, const char **argv, const char *prefix) OPT_STRING(0, "depth", &clone_data.depth, N_("string"), N_("depth for shallow clones")), - OPT__QUIET(&quiet, "Suppress output for cloning a submodule"), + OPT__QUIET(&quiet, "suppress output for cloning a submodule"), OPT_BOOL(0, "progress", &progress, N_("force cloning progress")), OPT_BOOL(0, "require-init", &require_init, diff --git a/check-usage-strings.sh b/check-usage-strings.sh new file mode 100755 index 00000000000000..a4028e0d00d584 --- /dev/null +++ b/check-usage-strings.sh @@ -0,0 +1,33 @@ +{ + if test -d ".git" + then + rev=${1:-"HEAD"} + for entry in $(git grep -l 'struct option .* = {$' "$rev" -- \*.c); + do + git show "$entry" | + sed -n '/struct option .* = {/,/OPT_END/{=;p;}' | + sed "N;s/^\\([0-9]*\\)\\n/$(echo "$entry" | sed 's/\//\\&/g'):\\1/"; + done + else + for entry in $(grep -rl --include="*.c" 'struct option .* = {$' . ); + do + cat "$entry" | + sed -n '/struct option .* = {/,/OPT_END/{=;p;}' | + sed "N;s/^\\([0-9]*\\)\\n/$(echo "$entry" | sed -e 's/\//\\&/g' -e 's/^\.\\\///'):\\1/"; + done + fi +} | +grep -Pe '((?"), - N_("Output to a specific file"), + N_("output to a specific file"), PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, OPT_END() diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c index 913775a14b758e..8f370cd89f1760 100644 --- a/t/helper/test-run-command.c +++ b/t/helper/test-run-command.c @@ -221,9 +221,9 @@ static int quote_stress_test(int argc, const char **argv) struct strbuf out = STRBUF_INIT; struct strvec args = STRVEC_INIT; struct option options[] = { - OPT_INTEGER('n', "trials", &trials, "Number of trials"), - OPT_INTEGER('s', "skip", &skip, "Skip trials"), - OPT_BOOL('m', "msys2", &msys2, "Test quoting for MSYS2's sh"), + OPT_INTEGER('n', "trials", &trials, "number of trials"), + OPT_INTEGER('s', "skip", &skip, "skip trials"), + OPT_BOOL('m', "msys2", &msys2, "test quoting for MSYS2's sh"), OPT_END() }; const char * const usage[] = {