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§
Source§impl<'a> FloweyCmd<'a>
impl<'a> FloweyCmd<'a>
Sourcepub fn env<K: AsRef<OsStr>, V: AsRef<OsStr>>(self, key: K, val: V) -> Self
pub fn env<K: AsRef<OsStr>, V: AsRef<OsStr>>(self, key: K, val: V) -> Self
Overrides the value of an environmental variable for this command.
Sourcepub fn envs<I, K, V>(self, vars: I) -> Self
pub fn envs<I, K, V>(self, vars: I) -> Self
Overrides the values of specified environmental variables for this command.
Sourcepub fn env_remove<K: AsRef<OsStr>>(self, key: K) -> Self
pub fn env_remove<K: AsRef<OsStr>>(self, key: K) -> Self
Removes an environment variable from this command.
Sourcepub fn ignore_status(self) -> Self
pub fn ignore_status(self) -> Self
If set, the command’s status code will not be checked, and non-zero exit codes will not produce an error.
Sourcepub fn set_ignore_status(&mut self, yes: bool)
pub fn set_ignore_status(&mut self, yes: bool)
Mutating variant of ignore_status.
Sourcepub fn secret(self) -> Self
pub fn secret(self) -> Self
If set, the command is treated as containing a secret and its display will be redacted.
Sourcepub fn set_secret(&mut self, yes: bool)
pub fn set_secret(&mut self, yes: bool)
Mutating variant of secret.
Sourcepub fn ignore_stdout(self) -> Self
pub fn ignore_stdout(self) -> Self
If set, stdout is not captured.
Sourcepub fn set_ignore_stdout(&mut self, yes: bool)
pub fn set_ignore_stdout(&mut self, yes: bool)
Mutating variant of ignore_stdout.
Sourcepub fn ignore_stderr(self) -> Self
pub fn ignore_stderr(self) -> Self
If set, stderr is not captured.
Sourcepub fn set_ignore_stderr(&mut self, yes: bool)
pub fn set_ignore_stderr(&mut self, yes: bool)
Mutating variant of ignore_stderr.
Sourcepub fn read(self) -> Result<String>
pub fn read(self) -> Result<String>
Run the command and return its stdout as a string, with leading and trailing whitespace trimmed.
Sourcepub fn read_stderr(self) -> Result<String>
pub fn read_stderr(self) -> Result<String>
Run the command and return its stderr as a string, with leading and trailing whitespace trimmed.