diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-07-19 00:54:04 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-07-20 01:30:06 +0200 |
commit | 448abbba63471153df6ba520a5621595557ce3c8 (patch) | |
tree | 49e2f80c40ec5cdf9163d6f6387122fe139676f2 /t/t0040-parse-options.sh | |
parent | Merge branch 'jk/redact-h2h3-headers-fix' into maint-2.41 (diff) | |
download | git-448abbba63471153df6ba520a5621595557ce3c8.tar.xz git-448abbba63471153df6ba520a5621595557ce3c8.zip |
short help: allow multi-line opthelp
When "-h" triggers the short-help in a command that implements its
option parsing using the parse-options API, the option help text is
shown with a single fprintf() as a long line. When the text is
multi-line, the second and subsequent lines are not left padded,
that breaks the alignment across options.
Borrowing the idea from the advice API where its hint strings are
shown with (localized) "hint:" prefix, let's internally split the
(localized) help text into lines, and showing the first line, pad
the remaining lines to align.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0040-parse-options.sh')
-rwxr-xr-x | t/t0040-parse-options.sh | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh index 7d7ecfd571..83e5d4eeb6 100755 --- a/t/t0040-parse-options.sh +++ b/t/t0040-parse-options.sh @@ -35,6 +35,8 @@ String options --string2 <str> get another string --st <st> get another string (pervert ordering) -o <str> get another string + --longhelp help text of this entry + spans multiple lines --list <str> add str to list Magic arguments |