#[doc = crate::_tags!(code platform runtime)]
#[doc = crate::_doc_location!("work/process")]
#[macro_export]
#[cfg_attr(cargo_primary_package, doc(hidden))]
macro_rules! cmd {
($($args:expr),+ $(,)?) => {{
$crate::CommandFlow::new($crate::cmd!(%cmd $($args),+))
}};
($($first:expr),+ $(=> $($rest:expr),+ )+) => {{
let p = $crate::CommandFlow::new($crate::cmd!(%cmd $($first),+)); $crate::cmd!(%flow p $(=> $($rest),+ )+) }};
() => { compile_error!("`cmd!` needs at least one command"); };
(%flow $flow:expr => $($next:expr),+ $(=> $($rest:expr),+ )*) => {{
let p = $flow.then($crate::cmd!(%cmd $($next),+)); $crate::cmd!(%flow p $(=> $($rest),+ )*) }};
(%flow $flow:expr) => { $flow };
(%cmd $cmd:literal) => {{
let mut it = $cmd.split_whitespace();
let prog = it.next().expect("empty command literal");
let mut c = $crate::Command::new(prog);
for arg in it { c.arg(arg); }
c
}};
(%cmd $prog:expr $(, $arg:expr)* $(,)?) => {{
let mut c = $crate::Command::new($prog); $( c.arg($arg); )* c
}};
}
#[doc(inline)]
pub use cmd;