Don't print description in help if none exists (#2915)

This commit is contained in:
Coen Fox 2021-01-13 05:27:48 +11:00 committed by GitHub
parent d19314fe3a
commit 3be198d2f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,8 +127,11 @@ pub fn get_documentation(
let signature = cmd.signature();
let mut long_desc = String::new();
long_desc.push_str(&cmd.usage());
long_desc.push('\n');
let usage = &cmd.usage();
if !usage.is_empty() {
long_desc.push_str(usage);
long_desc.push_str("\n\n");
}
let mut subcommands = vec![];
if !config.no_subcommands {
@ -168,7 +171,7 @@ pub fn get_documentation(
one_liner.push_str("{flags} ");
}
long_desc.push_str(&format!("\nUsage:\n > {}\n", one_liner));
long_desc.push_str(&format!("Usage:\n > {}\n", one_liner));
if !subcommands.is_empty() {
long_desc.push_str("\nSubcommands:\n");