Skip to main content

Cli

Struct Cli 

Source
pub struct Cli {
Show 22 fields pub question: Option<String>, pub cmd: Option<String>, pub stdin: Option<String>, pub mode: Option<Mode>, pub timeout: Option<f64>, pub heartbeat: HeartbeatOpts, pub err_match: Option<String>, pub err_match_stdout: Option<String>, pub err_match_stderr: Option<String>, pub ok_match: Option<String>, pub ok_match_stdout: Option<String>, pub ok_match_stderr: Option<String>, pub otherwise: Option<Otherwise>, pub focus: Option<String>, pub context: usize, pub capture_tail: Option<usize>, pub emit: Option<String>, pub emit_stderr: Option<String>, pub show_output: bool, pub quiet: bool, pub explain: Option<Format>, pub args: Vec<String>,
}

Fields§

§question: Option<String>

Question this experiment answers; printed as a “== … ==” banner.

§cmd: Option<String>

Program to run (must be on the fixed read-only allowlist).

§stdin: Option<String>

Text written to the child’s standard input. Accepts file:PATH / text:VALUE payloads.

§mode: Option<Mode>

Pin how matcher patterns are interpreted (promotion off): literal, glob, or regex.

§timeout: Option<f64>

Kill the command and classify ERROR if it runs longer than SECS seconds (fractional allowed); {CODE} becomes “timeout”.

§heartbeat: HeartbeatOpts§err_match: Option<String>

Match in stdout OR stderr forces ERROR (synonym for the -stdout/-stderr pair).

§err_match_stdout: Option<String>

Match in stdout forces ERROR.

§err_match_stderr: Option<String>

Match in stderr forces ERROR.

§ok_match: Option<String>

Match in stdout OR stderr indicates SUCCESS (synonym for the -stdout/-stderr pair).

§ok_match_stdout: Option<String>

Match in stdout indicates SUCCESS.

§ok_match_stderr: Option<String>

Match in stderr indicates SUCCESS.

§otherwise: Option<Otherwise>

Verdict when neither an –ok-match nor an –err-match matched: success, error, or exit (follow the exit code). Default: error if any –ok-match was given, else exit.

§focus: Option<String>

Distil captured output to lines matching this pattern (with –context around each), printed to stderr and available as {FOCUS}.

§context: usize

Lines of context shown around each –focus match.

§capture_tail: Option<usize>

Keep only the last N lines of each captured stream in the {STDOUT}/{STDERR} emit tokens (matchers and –focus still see everything).

§emit: Option<String>

Template written to stdout after running. Tokens: {RESULT} {CODE} {QUESTION} {CMD} {STDOUT} {STDERR} {REASON} {FOCUS}.

§emit_stderr: Option<String>

Template written to stderr after running (same tokens as –emit).

§show_output: bool

Also pass the child’s stdout/stderr through verbatim.

§quiet: bool

Suppress the question banner.

§explain: Option<Format>

Print agent usage docs (md or json) and exit.

§args: Vec<String>

Arguments passed through to –cmd (after --).

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.