Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split usage_message and help_message #240

Open
nappex opened this issue Aug 25, 2024 · 3 comments · May be fixed by #242
Open

Split usage_message and help_message #240

nappex opened this issue Aug 25, 2024 · 3 comments · May be fixed by #242
Assignees

Comments

@nappex
Copy link
Collaborator

nappex commented Aug 25, 2024

We'd like to split output to user if he invokes full content of help content with help option -h/--help and message when user misused the the command onigumo with invalid usage. Breifly said we want to apply same approach as curl or wget does.

@nappex nappex self-assigned this Aug 25, 2024
@Glutexo Glutexo added the cli label Aug 25, 2024
@Glutexo
Copy link
Owner

Glutexo commented Aug 25, 2024

cURL run without arguments prints only a message calling for --help, with no usage.

$ curl
curl: try 'curl --help' or 'curl --manual' for more information

With an invalid option, it prints an error message and a suggestion to use --help, but again no usage.

$ curl --invalid
curl: option --invalid: is unknown
curl: try 'curl --help' or 'curl --manual' for more information

Only with explicit --help switch, it prints the full help message including the usage.

$ curl --help
Usage: curl [options...] <url>
 -d, --data <data>           HTTP POST data
 -f, --fail                  Fail fast with no output on HTTP errors
 -h, --help <category>       Get help for commands
 -i, --include               Include response headers in output
 -o, --output <file>         Write to file instead of stdout
 -O, --remote-name           Write output to file named as remote file
 -s, --silent                Silent mode
 -T, --upload-file <file>    Transfer local FILE to destination
 -u, --user <user:password>  Server user and password
 -A, --user-agent <name>     Send User-Agent <name> to server
 -v, --verbose               Make the operation more talkative
 -V, --version               Show version number and quit

This is not the full help, this menu is stripped into categories.
Use "--help category" to get an overview of all categories.
For all options use the manual or "--help all".

@Glutexo
Copy link
Owner

Glutexo commented Aug 25, 2024

Wget, on the other hand, prints usage even in case of invalid arguments. In wget’s case, this includes no arguments too. It doesn’t print the full help message though.

$ wget
wget: missing URL
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.

To get the help message, it is necessary to explicitly provide the --help switch.

$ wget --help
Usage: curl [options...] <url>
 -d, --data <data>           HTTP POST data
…
  -np, --no-parent                 don't ascend to the parent directory

Email bug reports, questions, discussions to <[email protected]>
and/or open issues at https://savannah.gnu.org/bugs/?func=additem&group=wget.

@Glutexo
Copy link
Owner

Glutexo commented Aug 25, 2024

I think we can go either way and I slightly more prefer the Wget one, because the usage message is concise and still useful. The full help message, on the other hand, may be too long for the error to be clearly visible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants