docs: Update multiline usage override rules

The styling of usage has changed in #4188 such that the usage string is on
the same line as the "Usage:" title. Previously, the usage went on the line
below the title. As such, the rules have changed for how to make a
multiline usage format correctly.

These updated rules achieve the following output for the documented
example:

    Usage: myapp -X [-a] [-b] <file>
           myapp -Y [-c] <file1> <file2>
           myapp -Z [-d|-e]

Relates-to: #4132
This commit is contained in:
Peter Grayson 2022-09-26 21:57:09 -04:00
parent a0c8c7dbd5
commit 7dd216b1e6
No known key found for this signature in database
GPG key ID: 806EE62CA45D41B9

View file

@ -1662,7 +1662,7 @@ impl Command {
/// correctly by the default help formatter:
///
/// - Do not indent the first usage line.
/// - Indent all subsequent usage lines with four spaces.
/// - Indent all subsequent usage lines with seven spaces.
/// - The last line must not end with a newline.
///
/// # Examples
@ -1680,8 +1680,8 @@ impl Command {
/// # use clap::{Command, Arg};
/// Command::new("myprog")
/// .override_usage(
/// "myapp -X [-a] [-b] <file>\n \
/// myapp -Y [-c] <file1> <file2>\n \
/// "myapp -X [-a] [-b] <file>\n \
/// myapp -Y [-c] <file1> <file2>\n \
/// myapp -Z [-d|-e]"
/// )
/// # ;