#[cli]Expand description
Generate a CLI application from an impl block.
§Basic Usage
ⓘ
use server_less::cli;
#[cli]
impl MyApp {
fn create_user(&self, name: String) { /* ... */ }
}§With All Options
ⓘ
#[cli(
name = "myapp",
version = "1.0.0",
description = "My awesome application"
)]
impl MyApp {
/// Create a new user (becomes: myapp create-user <NAME>)
fn create_user(&self, name: String) { /* ... */ }
/// Optional flags use Option<T>
fn list_users(&self, limit: Option<usize>) { /* ... */ }
}§Generated Methods
cli_command() -> clap::Command- Complete CLI applicationcli_run(&self) -> Result<(), ...>- Execute CLI and handle result (sync entry point with tokio)cli_run_with(&self, matches: &ArgMatches) -> Result<(), ...>- Execute a pre-parsed commandcli_run_async(&self) -> impl Future<...>- Runtime-agnostic async entry pointcli_run_with_async(&self, matches: &ArgMatches) -> impl Future<...>- Async with pre-parsed matches