1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#[macro_export]
macro_rules! command {
($fmt:expr) => ( command!($fmt,) );
($fmt:expr, $( $id:ident = $value:expr ),* $(,)*) => (
{
$crate::commandify(
format!($fmt, $( $id = $crate::command_arg(&$value) ),*)
)
}
);
}
#[macro_export]
macro_rules! execute {
($fmt:expr) => ( execute!($fmt,) );
($fmt:expr, $( $id:ident = $value:expr ),* $(,)*) => (
{
use $crate::{CommandSpecExt};
command!($fmt, $( $id = $value ),*).unwrap().execute()
}
);
}
#[macro_export]
macro_rules! sh_command {
($fmt:expr) => ( sh_command!($fmt,) );
($fmt:expr, $( $id:ident = $value:expr ),* $(,)*) => (
$crate::commandify(
format!(
"sh -c {}",
$crate::command_arg(
&format!("set -e\n\n{}", format!($fmt, $( $id = $crate::command_arg(&$value) ,)*)),
),
)
)
);
}
#[macro_export]
macro_rules! sh_execute {
($fmt:expr) => ( sh_execute!($fmt,) );
($fmt:expr, $( $id:ident = $value:expr ),* $(,)*) => (
{
use $crate::{CommandSpecExt};
sh_command!($fmt, $( $id = $value ),*).unwrap().execute()
}
);
}