pub struct HelpConfig {
pub default_scope: HelpScope,
pub default_format: HelpFormat,
}Expand description
Configuration for pre-clap help handling.
The handler scans raw argv before Cli::try_parse() so applications can
support requests such as --help --output markdown without clap exiting
early with DisplayHelp.
Requires the cli-help feature.
Fields§
§default_scope: HelpScopeScope used for --help when --recursive is absent.
default_format: HelpFormatFallback format when the command has no valid default for --output.
An explicit --output always wins. When it is omitted, the handler
first inherits the command’s own --output default so help follows the
same output contract as every other successful result.
Implementations§
Source§impl HelpConfig
impl HelpConfig
Sourcepub const fn output_aware() -> Self
pub const fn output_aware() -> Self
The blessed preset for CLIs.
--help renders one-level help and inherits the command’s own
--output default. Scope and format are orthogonal: --recursive
expands the selected command subtree, while --output plain|json|yaml|markdown picks the format. Plain is only the fallback
for commands that do not declare a supported --output default.
Sourcepub const fn output_aware_with_fallback(default_format: HelpFormat) -> Self
pub const fn output_aware_with_fallback(default_format: HelpFormat) -> Self
Output-aware help with an explicit fallback format.
Use this for a fixed-format CLI that has no --output argument. For
example, a CLI whose normal output is always protocol JSON should pass
HelpFormat::Json. An explicit help --output, or a supported
default declared by the selected command or an ancestor, still wins.
Sourcepub const fn human_cli_default() -> Self
pub const fn human_cli_default() -> Self
Compatibility alias for Self::output_aware.
The historical name predates output-default inheritance and is less precise: a JSON-default command receives JSON help, not human text.
Trait Implementations§
Source§impl Clone for HelpConfig
impl Clone for HelpConfig
Source§fn clone(&self) -> HelpConfig
fn clone(&self) -> HelpConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HelpConfig
impl Debug for HelpConfig
impl Eq for HelpConfig
Source§impl PartialEq for HelpConfig
impl PartialEq for HelpConfig
impl StructuralPartialEq for HelpConfig
Auto Trait Implementations§
impl Freeze for HelpConfig
impl RefUnwindSafe for HelpConfig
impl Send for HelpConfig
impl Sync for HelpConfig
impl Unpin for HelpConfig
impl UnsafeUnpin for HelpConfig
impl UnwindSafe for HelpConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.