add documentation and test

* cmd documentation for cheat-sheet

* help.md: document cheat-sheet

Add documentation for cheat-sheet argument.

* curl: add line on cheat-sheet

* help.c: make test for cheat-sheet

* help.c: add cheat-sheet test

Test to verify no error with --help cheat-sheet argument.
This commit is contained in:
John Haugabook 2025-08-02 18:09:31 -04:00 committed by GitHub
parent 516e272b43
commit 5fed917a66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 42 additions and 4 deletions

View file

@ -23,11 +23,13 @@ Usage help. Provide help for the subject given as an optional argument.
If no argument is provided, curl displays the most important command line
arguments.
The argument can either be a **category** or a **command line option**. When a
category is provided, curl shows all command line options within the given
category. Specify category `all` to list all available options.
The argument can either be a **category**, a **command line option**, or
**cheat-sheet**. When a category is provided, curl shows all command line
options within the given category. Specify category `all` to list all
available options.
If `category` is specified, curl displays all available help categories.
If `cheat-sheet` is specified, curl displays a helpful cheat sheet.
If the provided subject is instead an existing command line option, specified
either in its short form with a single dash and a single letter, or in the

View file

@ -233,6 +233,7 @@ void tool_help(const char *category)
"Use \"--help all\" to list all options"
#ifdef USE_MANUAL
"\nUse \"--help [option]\" to view documentation for a given option"
"\nUse \"--help cheat-sheet\" to output a helpful cheat sheet"
#endif
;
puts("Usage: curl [options...] <url>");

View file

@ -226,7 +226,7 @@ test1670 test1671 \
test1680 test1681 test1682 test1683 \
\
test1700 test1701 test1702 test1703 test1704 test1705 test1706 test1707 \
test1708 test1709 test1710 \
test1708 test1709 test1710 test1711 \
\
test1800 test1801 \
\

View file

@ -55,6 +55,7 @@ output, pop3, post, proxy, scp, sftp, smtp, ssh, telnet, tftp, timeout, tls,
upload, verbose.
Use "--help all" to list all options
Use "--help [option]" to view documentation for a given option
Use "--help cheat-sheet" to output a helpful cheat sheet
</stdout>
</verify>
</testcase>

34
tests/data/test1711 Normal file
View file

@ -0,0 +1,34 @@
<testcase>
<info>
<keywords>
curl
</keywords>
</info>
#
# Client-side
<client>
<features>
manual
</features>
<server>
none
</server>
<name>
Verify curl -h cheat-sheet
</name>
<command>
-h cheat-sheet
</command>
</client>
#
# Verify no error
<verify>
<errorcode>
0
</errorcode>
</verify>
</testcase>