pub struct HelpConfig {
pub default_scope: HelpScope,
pub default_format: HelpFormat,
pub recursive_flag: Option<&'static str>,
pub output_flag: Option<&'static str>,
pub allow_output_format: bool,
pub protocol_mode: CliProtocolMode,
}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 / -h when neither --recursive nor a
configured recursive_flag is present.
default_format: HelpFormatFormat used for help when no explicit output flag is present.
recursive_flag: Option<&'static str>Optional extra alias for the built-in --recursive scope modifier.
--recursive is always recognized; set this only to accept an
additional custom flag name (for example --full). Like --recursive,
the alias is a modifier that selects recursive scope when --help is
present; on its own it does not trigger help.
output_flag: Option<&'static str>Optional output flag to read help format from, for example --output.
allow_output_format: boolWhether an explicit output flag can override default_format.
protocol_mode: CliProtocolModeEnvelope mode for structured help output and early errors.
Implementations§
Source§impl HelpConfig
impl HelpConfig
Sourcepub const fn new(default_scope: HelpScope, default_format: HelpFormat) -> Self
pub const fn new(default_scope: HelpScope, default_format: HelpFormat) -> Self
Construct a custom help handler configuration.
Sourcepub const fn human_cli_default() -> Self
pub const fn human_cli_default() -> Self
Recommended preset for human-facing CLIs.
--help renders one-level plain help by default. Scope and format are
orthogonal: --recursive expands the selected command subtree, while
--output json|yaml|markdown picks the format. So --help --recursive
is recursive plain text and --help --recursive --output markdown is a
recursive Markdown export.
Sourcepub const fn agent_cli_default() -> Self
pub const fn agent_cli_default() -> Self
Recommended preset for agent-first CLIs that want full surface help by default.
Sourcepub const fn with_default_scope(self, scope: HelpScope) -> Self
pub const fn with_default_scope(self, scope: HelpScope) -> Self
Return a copy with a different default scope.
Sourcepub const fn with_default_format(self, format: HelpFormat) -> Self
pub const fn with_default_format(self, format: HelpFormat) -> Self
Return a copy with a different default format.
Sourcepub const fn with_recursive_flag(self, flag: Option<&'static str>) -> Self
pub const fn with_recursive_flag(self, flag: Option<&'static str>) -> Self
Return a copy with a different recursive-help flag.
Sourcepub const fn with_output_flag(self, flag: Option<&'static str>) -> Self
pub const fn with_output_flag(self, flag: Option<&'static str>) -> Self
Return a copy with a different output flag.
Sourcepub const fn with_output_format_override(self, enabled: bool) -> Self
pub const fn with_output_format_override(self, enabled: bool) -> Self
Return a copy that enables or disables help format overrides.
Sourcepub const fn with_protocol_v1(self) -> Self
pub const fn with_protocol_v1(self) -> Self
Return a copy that wraps JSON/YAML help in a protocol-v1 result event.
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.