#[cli]Expand description
Lowers extension methods into named, composable CLI programs.
This is the CLI backend that alux_ext::ext(..., defunc(via = cli)) selects. via = cli
resolves the name in the authoring scope, so a declaration imports it as use alux_cli::cli.
Applying the attribute directly means the same thing.
Each method becomes a first-order CLI program. A command handler written with op(...) is
replaced by the operation type generated by alux_ext::ext(defunc), its declared argument sources
(.arg(...)) become one CliOperationAlg bound on the interpreter, .nest(name, ...)
nests a program beneath a name, and a call to another method of the same extension becomes a
nested program.
ⓘ
use alux_cli::{CliCommandsAlg, cli};
use alux_ext::ext;
#[ext(name = ReadingCliExt, defunc(via = cli))]
impl<This> This
where
This: CliCommandsAlg,
{
/// Declares the reading commands.
fn reading_cli<Machine, Name>(&self) {
self.commands()
.cmd("lookup", self.op(Machine::lookup).arg(self.positional("Requested name")))
}
}
// The expansion also defines `Program_reading_cli<Machine, Name>`.