Skip to main content

echo

Macro echo 

Source
macro_rules! echo {
    ($msg:expr) => { ... };
    ($fmt:expr, $($arg:tt)*) => { ... };
    (@parse $fmt:expr, nl = $nl:expr) => { ... };
    (@parse $fmt:expr, err = $err:expr) => { ... };
    (@parse $fmt:expr, nl = $nl:expr, err = $err:expr) => { ... };
    (@parse $fmt:expr, err = $err:expr, nl = $nl:expr) => { ... };
    (@parse $fmt:expr, color = $color:expr) => { ... };
    (@parse $fmt:expr, nl = $nl:expr, color = $color:expr) => { ... };
    (@parse $fmt:expr, err = $err:expr, color = $color:expr) => { ... };
    (@parse $fmt:expr, nl = $nl:expr, err = $err:expr, color = $color:expr) => { ... };
    (@parse $fmt:expr, $($arg:tt)*) => { ... };
}
Expand description

Convenience macro for printing to the terminal.

This macro wraps the echo function with a simpler syntax.

ยงUsage

use click::echo;

// Simple message with newline
echo!("Hello, world!");

// Without newline
echo!("Prompt: ", nl = false);

// To stderr
echo!("Error occurred", err = true);

// Combined
echo!("Warning: ", nl = false, err = true);

// With formatting
let name = "World";
echo!("Hello, {}!", name);