From 9cde072b616c06dc43184d378f5da6ea38854e2d Mon Sep 17 00:00:00 2001 From: Brooks J Rady Date: Thu, 13 Feb 2020 00:31:45 +0000 Subject: [PATCH] Use about() with help() and long_about() with long_help() --- src/output/help.rs | 9 +++++---- tests/help.rs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/output/help.rs b/src/output/help.rs index faf4bb97..32cc8f8f 100644 --- a/src/output/help.rs +++ b/src/output/help.rs @@ -821,12 +821,13 @@ impl<'b, 'c, 'd, 'w> Help<'b, 'c, 'd, 'w> { if let Some(author) = self.parser.app.author { write_thing!(author) } - if let Some(about) = self.parser.app.long_about { + + if self.use_long && self.parser.app.long_about.is_some() { debugln!("Help::write_default_help: writing long about"); - write_thing!(about) - } else if let Some(about) = self.parser.app.about { + write_thing!(self.parser.app.long_about.unwrap()) + } else if self.parser.app.about.is_some() { debugln!("Help::write_default_help: writing about"); - write_thing!(about) + write_thing!(self.parser.app.about.unwrap()) } self.color(Format::Warning("\nUSAGE:"))?; diff --git a/tests/help.rs b/tests/help.rs index 66375452..9fef4f9a 100644 --- a/tests/help.rs +++ b/tests/help.rs @@ -1496,7 +1496,7 @@ fn show_long_about_issue_897() { } static ISSUE_897_SHORT: &str = "ctest-foo 0.1 -Long about foo +About foo USAGE: ctest foo