clap_nested_commands/
sync_commands.rs#[macro_export]
macro_rules! generate_sync_commands {
($($module:ident),*) => (
generate_sync_commands!(return_type = (); $($module),*);
);
(return_type = $return_type:ty; $($module:ident),*) => (
paste::paste! {
#[derive(Debug, Subcommand)]
pub enum Commands {
$(
[<$module:camel>]($module::Command),
)*
}
pub fn execute(cli_context: &CliContext, cmd: Command) -> $return_type {
match cmd.command {
$(
Commands::[<$module:camel>](cmd) => $module::execute(cli_context, cmd),
)*
}
}
}
);
}