Macro commands
Source macro_rules! commands {
(@push $entries:ident;) => { ... };
(@push $entries:ident; $name:ident) => { ... };
(@push $entries:ident; $name:ident,) => { ... };
(@push $entries:ident; $name:ident, $($rest:tt)*) => { ... };
(@push $entries:ident; $alias:literal => $handler:ident) => { ... };
(@push $entries:ident; $alias:literal => $handler:ident,) => { ... };
(@push $entries:ident; $alias:literal => $handler:ident, $($rest:tt)*) => { ... };
() => { ... };
($($item:tt)*) => { ... };
}
Expand description
Register application commands without clap boilerplate.
§Examples
ⓘcommands! {
update,
"sync-users" => sync_users,
}
Generates pub fn registry() -> Vec<CommandEntry> in the enclosing module.