mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 23:37:32 +00:00
fix: doesn't print the argument sections in the help message if all args in that section are hidden
This commit is contained in:
parent
539ad6073f
commit
d63d404e5e
1 changed files with 24 additions and 0 deletions
|
@ -557,6 +557,30 @@ impl<'a, 'b> Parser<'a, 'b>
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn has_subcommands(&self) -> bool { !self.subcommands.is_empty() }
|
pub fn has_subcommands(&self) -> bool { !self.subcommands.is_empty() }
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn has_visible_opts(&self) -> bool {
|
||||||
|
if self.opts.is_empty() { return false; }
|
||||||
|
self.opts.iter().any(|o| !o.is_set(ArgSettings::Hidden))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn has_visible_flags(&self) -> bool {
|
||||||
|
if self.flags.is_empty() { return false; }
|
||||||
|
self.flags.iter().any(|f| !f.is_set(ArgSettings::Hidden))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn has_visible_positionals(&self) -> bool {
|
||||||
|
if self.positionals.is_empty() { return false; }
|
||||||
|
self.positionals.values().any(|p| !p.is_set(ArgSettings::Hidden))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn has_visible_subcommands(&self) -> bool {
|
||||||
|
if self.subcommands.is_empty() { return false; }
|
||||||
|
self.subcommands.iter().any(|s| !s.is_set(AppSettings::Hidden))
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_set(&self, s: AS) -> bool { self.settings.is_set(s) }
|
pub fn is_set(&self, s: AS) -> bool { self.settings.is_set(s) }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue