From 7dd216b1e634559982d5601b9d14cabdc2f439d9 Mon Sep 17 00:00:00 2001 From: Peter Grayson Date: Mon, 26 Sep 2022 21:57:09 -0400 Subject: [PATCH] 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] myapp -Y [-c] myapp -Z [-d|-e] Relates-to: #4132 --- src/builder/command.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/builder/command.rs b/src/builder/command.rs index 4be5b55a392..eace041538c 100644 --- a/src/builder/command.rs +++ b/src/builder/command.rs @@ -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] \n \ - /// myapp -Y [-c] \n \ + /// "myapp -X [-a] [-b] \n \ + /// myapp -Y [-c] \n \ /// myapp -Z [-d|-e]" /// ) /// # ;