Macro repo_backup::cmd[][src]

macro_rules! cmd {
    (in $cwd:expr; $format:expr, $arg:expr) => { ... };
    (in $cwd:expr; $command:expr) => { ... };
    ($format:expr, $($arg:expr),*) => { ... };
    ($command:expr) => { ... };
}

A convenient command runner.

It behaves like the format!() macro, then splits the input string up like your shell would before running the command and inspecting its output to ensure everything was successful.

Examples

#[macro_use]
extern crate repo_backup;

let some_url = "https://github.com/Michael-F-Bryan/repo-backup";
cmd!(in "/path/to/dir/"; "git clone {}", some_url)?;