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!
):
cmd!(echo (foo)(bar)baz(qux))
#[macro_use] extern crate command_macros;
fn main() {
cmd!( echo ((2+2)) ).status().unwrap();
}