Skip to main content

CliArgs

Struct CliArgs 

Source
pub struct CliArgs {
Show 27 fields pub lang: Option<String>, pub verbose: u8, pub quiet: bool, pub config_dir: Option<PathBuf>, pub no_color: bool, pub output_format: Option<OutputFormat>, pub json: bool, pub select: Vec<String>, pub filter: Vec<String>, pub limit: Option<usize>, pub sort: Option<String>, pub dedupe_by: Option<String>, pub count_only: bool, pub truncate_content: Option<usize>, pub max_output_bytes: Option<usize>, pub no_input: bool, pub dry_run: bool, pub disable_sudo: bool, pub replace_host_key: bool, pub allow_plaintext_secrets: bool, pub secrets_key_file: Option<PathBuf>, pub use_keyring: bool, pub timeout: Option<u64>, pub max_concurrency: Option<u16>, pub fail_fast: bool, pub scp_file_concurrency: Option<u16>, pub command: Command,
}
Expand description

Global ssh-cli arguments.

Fields§

§lang: Option<String>

Forces the CLI language (BCP47; must negotiate to en or pt-BR).

Examples: en, en-US, pt-BR, pt. Invalid tags fail clap validation.

§verbose: u8

Increases log verbosity on stderr (-v info, -vv debug, -vvv trace).

Always scoped to this crate (G2/G14): never a bare global debug/trace that would enable russh::client::encrypted password dumps.

§quiet: bool

Suppresses non-JSON output (quiet mode).

§config_dir: Option<PathBuf>

Configuration directory override (useful for tests).

§no_color: bool

Disables colored output.

§output_format: Option<OutputFormat>

Global output format (text, json). If omitted: JSON when stdout is not a TTY.

§json: bool

Force JSON on stdout (agent; alias of --output-format json; G-AUD-01).

Global — appears before or after subcommands. Subcommand fields use from_global so there is a single --json long name (clap uniqueness).

§select: Vec<String>

Keep only these dotted paths in each record (CSV; alias --fields).

Agent-native shaping: applied before serialization, so the full envelope is never built. Without it an agent must pipe through jaq, by which point the oversized payload has already been written and the tokens already spent.

§filter: Vec<String>

Keep records matching key=value, key!=value or key~substring (repeatable, AND).

A malformed predicate is rejected at parse time rather than silently matching nothing — a typo must not be indistinguishable from an empty result.

§limit: Option<usize>

Emit at most N records (distinct from per-command query limits).

§sort: Option<String>

Sort records ascending by dotted path (numbers compare numerically).

§dedupe_by: Option<String>

Drop later records repeating this dotted path’s value.

§count_only: bool

Replace the record collection with {"count": N}, counted after all filtering.

§truncate_content: Option<usize>

Shorten strings longer than N characters (never bytes; UTF-8 stays valid).

§max_output_bytes: Option<usize>

Cap envelope size by dropping trailing records (never by slicing the JSON text).

§no_input: bool

Refuse to read stdin; fail fast instead of blocking on an absent human.

§dry_run: bool

Print the plan for a destructive operation and exit without executing it.

Accepted only by commands that implement it (see supports_dry_run); anywhere else it is rejected with exit 64 rather than accepted and ignored. A global flag that silently does nothing on half the surface is worse than no flag at all — that is exactly how --no-input shipped broken on vps add.

§disable_sudo: bool

Disables sudo-exec/su-exec for this invocation (alias –disableSudo).

§replace_host_key: bool

Replaces a diverging host key in TOFU known_hosts.

§allow_plaintext_secrets: bool

Allow plaintext secrets at rest (no auto secrets.key). Prefer for tests only.

§secrets_key_file: Option<PathBuf>

Path to a 64-hex primary-key file (overrides XDG secrets.key for this one-shot).

§use_keyring: bool

Prefer OS keyring for the primary key (CLI flag only; no product env store).

§timeout: Option<u64>

Global default timeout in milliseconds for SSH ops (exec/scp/health-check). Local --timeout on a subcommand wins. Tunnel still requires --timeout-ms.

§max_concurrency: Option<u16>

Cap concurrent multi-host SSH sessions / tunnel forwards (1..=MAX_CONCURRENCY).

Default: auto from CPUs × I/O oversubscribe vs free RAM (see concurrency). Applies to --all fan-out and tunnel accepts (no env store; G-UNSAFE-14).

§fail_fast: bool

Stop admitting new multi-host units after the first failure (G-O1).

Default: continue all hosts (agent-friendly partial success). In-flight units still finish; never-started hosts are omitted from batch results unless callers pad skipped rows.

§scp_file_concurrency: Option<u16>

Max concurrent SCP file transfers on one SSH session (G-O4).

Default: 1 (serial multi-file, session reuse). Values >1 open parallel SCP channels on the same session (bounded). Env: not used; CLI only.

§command: Command

Subcommand to run.

Trait Implementations§

Source§

impl Args for CliArgs

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 CommandFactory for CliArgs

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 CliArgs

Source§

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

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

impl FromArgMatches for CliArgs

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 CliArgs

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§

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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