pub struct VersionConfig {
pub default_output: Option<OutputFormat>,
pub output_flag: Option<&'static str>,
pub output_short: Option<char>,
pub allow_output_format: bool,
}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 {code:"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.
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.
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
Source§fn eq(&self, other: &VersionConfig) -> bool
fn eq(&self, other: &VersionConfig) -> bool
self and other values to be equal, and is used by ==.