Macro command_macros::cmd[][src]

macro_rules! cmd {
    ({$e:expr}) => { ... };
    ({$e:expr} (($a:expr)) $($tail:tt)*) => { ... };
    ({$e:expr} ($a:expr) $($tail:tt)*) => { ... };
    ({$e:expr} [$aa:expr] $($tail:tt)*) => { ... };
    ({$e:expr} match ($m:expr) { $($($p:pat)|+ $(if $g:expr)* => {$($rr:tt)*} ),* } $($tail:tt)*) => { ... };
    ({$e:expr} match ($m:expr) { $($($p:pat)|+ $(if $g:expr)* => {$($rr:tt)*},)* } $($tail:tt)*) => { ... };
    ({$e:expr} match ($m:expr) { $($($p:pat)|+ $(if $g:expr)* => {$($rr:tt)*} )* } $($tail:tt)*) => { ... };
    ({$e:expr} if let $p:pat = ($m:expr) { $($then:tt)* } else { $($els:tt)* } $($tail:tt)*) => { ... };
    ({$e:expr} if let $p:pat = ($m:expr) { $($then:tt)* } $($tail:tt)*) => { ... };
    ({$e:expr} if ($b:expr) { $($then:tt)* } else { $($els:tt)* } $($tail:tt)*) => { ... };
    ({$e:expr} if ($b:expr) { $($then:tt)* } $($tail:tt)*) => { ... };
    ({$e:expr} for $p:pat in ($i:expr) { $($body:tt)* } $($tail:tt)*) => { ... };
    ({$e:expr} $a:ident $($tail:tt)*) => { ... };
    (($c:expr) $($tail:tt)*) => { ... };
    ($c:ident $($tail:tt)*) => { ... };
}

Simple macro for creating Command.

Please read the syntax description in the crate's documentation.

Please note that this macro is not whitespace-sensitive and the following will evaluate to four separate arguments (as opposed to one in command!):

This example is not tested
cmd!(echo (foo)(bar)baz(qux)) // don't do it!

Examples

#[macro_use] extern crate command_macros;

fn main() {
    cmd!( echo ((2+2)) ).status().unwrap();
}