macro_rules! subcommands {
(
[$argtype:ty => $prep:expr]
$(
$(#[cfg($cfg:meta)])*
$(#[clap($clap:meta)])*
$modname:ident => $enumname:ident($argname:ident)
),+
) => { ... };
}Expand description
Wire up a subcommand level.
Generates an Action enum (one variant per subcommand), and a run(args, ctx) dispatcher. The prep closure runs before dispatch: it returns the
chosen Action along with a Context that has been populated with this
level’s args (and anything else the level wants to provide). Each variant
then dispatches to <modname>::run(sub_args, ctx).
Every level uses the same (args, ctx) signature, so contexts compose
across arbitrary nesting depth and downstream handlers can extract any
ancestor’s args by type via ctx.require::<T>().