mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 23:37:32 +00:00
parent
2094c28d15
commit
a8257ea0ff
3 changed files with 23 additions and 4 deletions
|
@ -657,8 +657,22 @@ impl<'a> Help<'a> {
|
|||
if let Some(author) = parser.meta.author {
|
||||
write_thing!(author)
|
||||
}
|
||||
if let Some(about) = parser.meta.about {
|
||||
write_thing!(about)
|
||||
if self.use_long {
|
||||
if let Some(about) = parser.meta.long_about {
|
||||
debugln!("Help::write_default_help: writing long about");
|
||||
write_thing!(about)
|
||||
} else if let Some(about) = parser.meta.about {
|
||||
debugln!("Help::write_default_help: writing about");
|
||||
write_thing!(about)
|
||||
}
|
||||
} else {
|
||||
if let Some(about) = parser.meta.about {
|
||||
debugln!("Help::write_default_help: writing about");
|
||||
write_thing!(about)
|
||||
} else if let Some(about) = parser.meta.long_about {
|
||||
debugln!("Help::write_default_help: writing long about");
|
||||
write_thing!(about)
|
||||
}
|
||||
}
|
||||
|
||||
color!(self, "\nUSAGE:", warning)?;
|
||||
|
@ -861,6 +875,11 @@ impl<'a> Help<'a> {
|
|||
"{}",
|
||||
parser.meta.about.unwrap_or("unknown about"))?;
|
||||
}
|
||||
b"long-about" => {
|
||||
write!(self.writer,
|
||||
"{}",
|
||||
parser.meta.long_about.unwrap_or("unknown about"))?;
|
||||
}
|
||||
b"usage" => {
|
||||
write!(self.writer, "{}", usage::create_usage_no_title(parser, &[]))?;
|
||||
}
|
||||
|
|
|
@ -1339,7 +1339,8 @@ impl<'a, 'b> Parser<'a, 'b>
|
|||
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(let_and_return))]
|
||||
fn use_long_help(&self) -> bool {
|
||||
let ul = self.flags.iter().any(|f| f.b.long_help.is_some()) ||
|
||||
let ul = self.meta.long_about.is_some() ||
|
||||
self.flags.iter().any(|f| f.b.long_help.is_some()) ||
|
||||
self.opts.iter().any(|o| o.b.long_help.is_some()) ||
|
||||
self.positionals.values().any(|p| p.b.long_help.is_some()) ||
|
||||
self.subcommands
|
||||
|
|
|
@ -542,7 +542,6 @@ extern crate vec_map;
|
|||
#[cfg(feature = "wrap_help")]
|
||||
extern crate term_size;
|
||||
extern crate textwrap;
|
||||
extern crate unicode_segmentation;
|
||||
#[cfg(feature = "color")]
|
||||
extern crate atty;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue