Macro command

Source
command!() { /* proc-macro */ }
Expand description

Full-featured macro for creating Command

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

This macro is intended to be used via reexport in command_macros crate with a “nightly” feature enabled.

§Examples

#![feature(proc_macro_hygiene)]

// also reexported in extern crate command_macros;
extern crate command_macros_plugin;
 
// also reexported as command_macros::command
use command_macros_plugin::command;

fn main() {
    command!(echo foo --bar ((2+2))=4).status().unwrap();
    // should echo: foo --bar 4=4
}

§Stability

This is an experimental, nightly-only version of cmd! macro, so it might break with a nightly update from time to time. However, it uses a new proc_macro interface rather than compiler internals, so the breakage shouldn’t occur too often.

In future, when the proc_macro interface is stabilized, this macro should work on stable without significant changes.