Struct FloweyCmd
pub struct FloweyCmd<'a> { /* private fields */ }Expand description
A wrapper around [xshell::Cmd] that applies a CommandWrapperKind
at execution time.
Builder methods (.arg(), .env(), etc.) are accumulated on the
inner [xshell::Cmd] (for args) or in shadow fields (for env, stdin,
and flags). Execution methods (.run(), .read(), etc.) consume
self, apply the wrapper transformation, re-apply the shadowed state,
and then execute.
Implementations§
§impl<'a> FloweyCmd<'a>
impl<'a> FloweyCmd<'a>
pub fn env<K, V>(self, key: K, val: V) -> FloweyCmd<'a>
pub fn env<K, V>(self, key: K, val: V) -> FloweyCmd<'a>
Overrides the value of an environmental variable for this command.
pub fn envs<I, K, V>(self, vars: I) -> FloweyCmd<'a>
pub fn envs<I, K, V>(self, vars: I) -> FloweyCmd<'a>
Overrides the values of specified environmental variables for this command.
pub fn env_remove<K>(self, key: K) -> FloweyCmd<'a>
pub fn env_remove<K>(self, key: K) -> FloweyCmd<'a>
Removes an environment variable from this command.
pub fn ignore_status(self) -> FloweyCmd<'a>
pub fn ignore_status(self) -> FloweyCmd<'a>
If set, the command’s status code will not be checked, and non-zero exit codes will not produce an error.
pub fn set_ignore_status(&mut self, yes: bool)
pub fn set_ignore_status(&mut self, yes: bool)
Mutating variant of ignore_status.
pub fn secret(self) -> FloweyCmd<'a>
pub fn secret(self) -> FloweyCmd<'a>
If set, the command is treated as containing a secret and its display will be redacted.
pub fn set_secret(&mut self, yes: bool)
pub fn set_secret(&mut self, yes: bool)
Mutating variant of secret.
pub fn ignore_stdout(self) -> FloweyCmd<'a>
pub fn ignore_stdout(self) -> FloweyCmd<'a>
If set, stdout is not captured.
pub fn set_ignore_stdout(&mut self, yes: bool)
pub fn set_ignore_stdout(&mut self, yes: bool)
Mutating variant of ignore_stdout.
pub fn ignore_stderr(self) -> FloweyCmd<'a>
pub fn ignore_stderr(self) -> FloweyCmd<'a>
If set, stderr is not captured.
pub fn set_ignore_stderr(&mut self, yes: bool)
pub fn set_ignore_stderr(&mut self, yes: bool)
Mutating variant of ignore_stderr.
pub fn read(self) -> Result<String, Error>
pub fn read(self) -> Result<String, Error>
Run the command and return its stdout as a string, with leading and trailing whitespace trimmed.
pub fn read_stderr(self) -> Result<String, Error>
pub fn read_stderr(self) -> Result<String, Error>
Run the command and return its stderr as a string, with leading and trailing whitespace trimmed.