command
ModuleShell-safe commands: plain commands built argument by argument, and
pipelines, &&/|| lists, groups and redirections of them.
Contents
use utopia_console::Arg;Rust
pub struct Arg(String)Undocumented.
Also implements
From.use utopia_console::Command;Rust
pub struct CommandA command line built without string concatenation: a plain command
(an executable, flags, options and arguments, each one shell word), or a
pipeline, an &&/|| list, a group or a redirection of commands.
A plain command runs without a shell (Command::to_array); the others
render to a shell string where every word is quoted
(Command::to_shell).
Rust
use utopia_console::Command;
let tar = Command::new("tar")?.flag("-cz")?.option("-f", "archive.tar.gz")?.argument(".")?;
assert_eq!(tar.to_array()?, ["tar", "-cz", "-f", "archive.tar.gz", "."]);
let errors = Command::append_stdout(
Command::pipe(vec![Command::new("cat")?.argument("app.log")?, Command::new("grep")?.argument("ERROR")?])?,
"errors.log",
)?;
assert_eq!(errors.to_shell()?, "'cat' 'app.log' | 'grep' 'ERROR' >> 'errors.log'");Also implements
Display.use utopia_console::Check;Rust
pub enum Check<'a>How an argument is checked before it is added.
Also implements
Debug.use utopia_console::Operator;Rust
pub enum OperatorThe operator joining the commands of a list.
use utopia_console::Redirect;Rust
pub enum RedirectA redirection of a command's standard streams.