macro_rules! help {
($header:literal: $($rest:tt)*) => { ... };
(
$cmd:literal $([$param:literal])* => $description:literal
$($rest:tt)*
) => { ... };
(
$cmd:literal $([$param:literal])* => {
$($description:literal),* $(,)?
}
$($rest:tt)*
) => { ... };
() => { ... };
}Expand description
Makes creating help easier
§Header:
- Printed in green
ⓘ
"header":§Command help:
- Command is printed in yellow and has left padding of 2
- Others in default color
- Description has left padding of 4
ⓘ
// One description literals
"command" ["params"]* => "description"
// Multiple description literals
"command" ["params"]* => {
"description1",
"description2"
}§Usage:
help!(
"Usage":
"-t" ["value"] => "Tests program with [value]"
"-d" => {
"Creates documentation",
"When used with -t, also tests the documentation",
}
"Special case":
"-ntd" => "Creates documentation and runs test without testing docs"
);