diff --git a/src/builder/command.rs b/src/builder/command.rs index 7aa10e0ac08a..88fc1cb90c18 100644 --- a/src/builder/command.rs +++ b/src/builder/command.rs @@ -1648,6 +1648,14 @@ impl<'help> App<'help> { /// strings. After this setting is set, this will be *the only* usage string /// displayed to the user! /// + /// **NOTE:** Multiple usage lines may be present in the usage argument, but + /// some rules need to be followed to ensure the usage lines are formatted + /// correctly by the default help formatter: + /// + /// - Do not indent the first usage line. + /// - Indent all subsequent usage lines with four spaces. + /// - The last line must not end with a newline. + /// /// # Examples /// /// ```no_run @@ -1656,6 +1664,20 @@ impl<'help> App<'help> { /// .override_usage("myapp [-clDas] ") /// # ; /// ``` + /// + /// Or for multiple usage lines: + /// + /// ```no_run + /// # use clap::{Command, Arg}; + /// Command::new("myprog") + /// .override_usage( + /// "myapp -X [-a] [-b] \n \ + /// myapp -Y [-c] \n \ + /// myapp -Z [-d|-e]" + /// ) + /// # ; + /// ``` + /// /// [`ArgMatches::usage`]: ArgMatches::usage() #[must_use] pub fn override_usage>(mut self, usage: S) -> Self {