Skip to main content

Cli

Struct Cli 

Source
pub struct Cli {
Show 26 fields pub json: bool, pub format: Option<OutputFormat>, pub timeout: Option<u64>, pub connect_timeout: Option<u64>, pub user_agent: Option<String>, pub lang: Option<String>, pub config_dir: Option<PathBuf>, pub cache_dir: Option<PathBuf>, pub no_cache: bool, pub cache_ttl_secs: Option<u64>, pub max_cache_bytes: Option<u64>, pub dry_run: bool, pub max_body_bytes: Option<u64>, pub agent: AgentArgs, pub rate_limit_delay_ms: Option<u64>, pub max_concurrency: Option<u32>, pub max_retries: Option<u32>, pub retry_base_ms: Option<u64>, pub retry_max_delay_ms: Option<u64>, pub retry_max_elapsed_ms: Option<u64>, pub disable_retry: bool, pub allow_loopback: bool, pub verbose: u8, pub quiet: bool, pub no_color: bool, pub command: Commands,
}
Expand description

Top-level clap parser for the docsrs-cli binary.

Fields§

§json: bool

Emit JSON envelope on stdout

§format: Option<OutputFormat>

Output format (json is alias of –json)

§timeout: Option<u64>

Wall-clock timeout in seconds (must be >= 1 when set)

§connect_timeout: Option<u64>

Connect timeout in seconds (must be >= 1 when set)

§user_agent: Option<String>

Override User-Agent

§lang: Option<String>

Force human stderr locale: en or pt-BR (fail-closed; JSON stays English)

§config_dir: Option<PathBuf>

Override XDG config directory

§cache_dir: Option<PathBuf>

Override XDG cache directory for HTTP body cache

§no_cache: bool

Disable disk cache (always hit network)

§cache_ttl_secs: Option<u64>

Disk cache TTL in seconds (default 86400 = 24h)

§max_cache_bytes: Option<u64>

Soft cap on disk cache size in bytes (default 268435456 = 256 MiB; 0 = unlimited)

§dry_run: bool

Plan URLs without opening network sockets

§max_body_bytes: Option<u64>

Cap downloaded body size in bytes (hard max 10485760 = 10 MiB; cannot raise above)

§agent: AgentArgs

Agent-native payload reduction knobs (see AgentArgs).

§rate_limit_delay_ms: Option<u64>

Minimum delay between requests to the same host (ms)

§max_concurrency: Option<u32>

Max concurrent CPU parse workers (0 = auto from CPUs and free RAM)

§max_retries: Option<u32>

Max HTTP retries for transient errors (after the first attempt)

§retry_base_ms: Option<u64>

Base backoff delay in milliseconds for HTTP retries

§retry_max_delay_ms: Option<u64>

Maximum single HTTP retry sleep in milliseconds

§retry_max_elapsed_ms: Option<u64>

Total HTTP retry wall budget in milliseconds (0 = derive from –timeout)

§disable_retry: bool

Disable HTTP retries (incident kill switch / debug)

§allow_loopback: bool

Allow loopback origins (127.0.0.1 / localhost) for offline wiremock

Also settable via XDG config.toml allow_loopback = true. Never via env.

§verbose: u8

Increase stderr verbosity

§quiet: bool

Suppress non-error stderr prose

§no_color: bool

Disable ANSI colors on stderr

§command: Commands

Subcommand to execute for this invocation.

Implementations§

Source§

impl Cli

Source

pub fn wire_command(&self) -> &'static str

Wire command name for the active subcommand (error/success envelopes).

Source

pub fn wants_json(&self, stdout_is_terminal: bool) -> bool

Whether JSON envelope is requested.

Agent-first rules (stdin/stdout LLM contract):

  • --json or --format json → JSON
  • --format markdown|text → human (never auto-JSON)
  • otherwise → JSON when stdout is not a TTY (pipe/agent), markdown on TTY
Source

pub fn validate_format_conflict(&self) -> Result<(), AppError>

Reject incompatible --json + --format text|markdown.

§Errors

Returns crate::error::ErrorKind::Usage when --json is combined with --format text or --format markdown.

Trait Implementations§

Source§

impl Args for Cli

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl Clone for Cli

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CommandFactory for Cli

Source§

fn command<'b>() -> Command

Build a Command that can instantiate Self. Read more
Source§

fn command_for_update<'b>() -> Command

Build a Command that can update self. Read more
Source§

impl Debug for Cli

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromArgMatches for Cli

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Parser for Cli

Source§

fn parse() -> Self

Parse from std::env::args_os(), exit on error.
Source§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
Source§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, exit on error.
Source§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
Source§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, exit on error. Read more
Source§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.

Auto Trait Implementations§

§

impl Freeze for Cli

§

impl RefUnwindSafe for Cli

§

impl Send for Cli

§

impl Sync for Cli

§

impl Unpin for Cli

§

impl UnsafeUnpin for Cli

§

impl UnwindSafe for Cli

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more