pub struct VersionConfig {
pub default_output: Option<OutputFormat>,
pub output_flag: Option<&'static str>,
pub output_short: Option<char>,
pub allow_output_format: bool,
pub protocol_mode: CliProtocolMode,
}Expand description
Configuration for pre-parser --version handling.
This helper scans raw argv before the application’s argument parser so
--version --output json can return an AFDATA event instead of letting
clap or another parser print conventional plain text and exit.
Fields§
§default_output: Option<OutputFormat>Format used for --version when no explicit output flag is present.
Some(format) renders an AFDATA kind:"result" version event in that
format. None preserves conventional CLI output: <name> <version>.
output_flag: Option<&'static str>Optional long output flag to read, for example --output.
output_short: Option<char>Optional short output flag to read, for example -o.
allow_output_format: boolWhether an explicit output flag can override default_output.
protocol_mode: CliProtocolModeEnvelope mode for structured version output and early errors.
Implementations§
Source§impl VersionConfig
impl VersionConfig
Sourcepub const fn new(default_output: Option<OutputFormat>) -> Self
pub const fn new(default_output: Option<OutputFormat>) -> Self
Construct a custom version handler configuration.
Sourcepub const fn agent_cli_default() -> Self
pub const fn agent_cli_default() -> Self
Structured bare-version preset.
A bare --version is a JSON AFDATA event. Most CLIs should prefer
Self::conventional_default so human --version stays familiar while
explicit --output json|yaml|plain remains structured.
Sourcepub const fn conventional_default() -> Self
pub const fn conventional_default() -> Self
Recommended preset: keep conventional bare version text while still
honoring explicit --output json|yaml|plain.
Sourcepub const fn with_default_output(
self,
default_output: Option<OutputFormat>,
) -> Self
pub const fn with_default_output( self, default_output: Option<OutputFormat>, ) -> Self
Return a copy with a different default output.
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 long output flag.
Sourcepub const fn with_output_short(self, flag: Option<char>) -> Self
pub const fn with_output_short(self, flag: Option<char>) -> Self
Return a copy with a different short 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 explicit output overrides.
Sourcepub const fn with_protocol_v1(self) -> Self
pub const fn with_protocol_v1(self) -> Self
Return a copy that emits protocol-v1 structured early exits.
Trait Implementations§
Source§impl Clone for VersionConfig
impl Clone for VersionConfig
Source§fn clone(&self) -> VersionConfig
fn clone(&self) -> VersionConfig
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 VersionConfig
impl Debug for VersionConfig
impl Eq for VersionConfig
Source§impl PartialEq for VersionConfig
impl PartialEq for VersionConfig
impl StructuralPartialEq for VersionConfig
Auto Trait Implementations§
impl Freeze for VersionConfig
impl RefUnwindSafe for VersionConfig
impl Send for VersionConfig
impl Sync for VersionConfig
impl Unpin for VersionConfig
impl UnsafeUnpin for VersionConfig
impl UnwindSafe for VersionConfig
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.