diff options
| author | René Scharfe <l.s.r@web.de> | 2023-08-05 16:38:56 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-08-06 17:16:50 -0700 |
| commit | 8dcb49021e0134a1be1f533596e2bcf8313dea33 (patch) | |
| tree | 8a00fb3f7d1426171c35b63060b61c31a80744bc /t/t1502 | |
| parent | aa43619bdf690c8ed44746030552a35244f97af7 (diff) | |
| download | git-8dcb49021e0134a1be1f533596e2bcf8313dea33.tar.gz | |
t1502: move optionspec help output to a file
"git rev-parse --parseopt" shows the short help with its description of
all recognized options twice: When called with -h or --help, and after
reporting an unknown option. Move the one for optionspec into a file
and use it in two tests to deduplicate that part.
"git rev-parse --parseopt -- --h" wraps the help text in "cat <<\EOF"
and "EOF". Keep that part in the file to use it as is in the test that
needs it and simply remove it in the other one using sed.
Disable whitespace checking for the file using an attribute, as we need
to keep its spaces intact and wouldn't want a stray --whitespace=fix
turn them into tabs.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1502')
| -rw-r--r-- | t/t1502/.gitattributes | 1 | ||||
| -rwxr-xr-x | t/t1502/optionspec.help | 34 |
2 files changed, 35 insertions, 0 deletions
diff --git a/t/t1502/.gitattributes b/t/t1502/.gitattributes new file mode 100644 index 0000000000..562b12e16e --- /dev/null +++ b/t/t1502/.gitattributes @@ -0,0 +1 @@ +* -whitespace diff --git a/t/t1502/optionspec.help b/t/t1502/optionspec.help new file mode 100755 index 0000000000..844eac6704 --- /dev/null +++ b/t/t1502/optionspec.help @@ -0,0 +1,34 @@ +cat <<\EOF +usage: some-command [options] <args>... + + some-command does foo and bar! + + -h, --help show the help + --foo some nifty option --foo + --bar ... some cool option --bar with an argument + -b, --baz a short and long option + +An option group Header + -C[...] option C with an optional argument + -d, --data[=...] short and long option with an optional argument + +Argument hints + -B <arg> short option required argument + --bar2 <arg> long option required argument + -e, --fuz <with-space> + short and long option required argument + -s[<some>] short option optional argument + --long[=<data>] long option optional argument + -g, --fluf[=<path>] short and long option optional argument + --longest <very-long-argument-hint> + a very long argument hint + --pair <key=value> with an equals sign in the hint + --aswitch help te=t contains? fl*g characters!` + --bswitch <hint> hint has trailing tab character + --cswitch switch has trailing tab character + --short-hint <a> with a one symbol hint + +Extras + --extra1 line above used to cause a segfault but no longer does + +EOF |
