#[application]Expand description
Add a TUI application to a Clawless project
This macro attribute registers a function as a TUI application in a Clawless project. Unlike
#[command], which creates a stateless CLI command rendered through a push-based presenter,
#[application] creates a stateful TUI application that queries a pull-based projection.
Application functions must accept exactly three parameters:
- An
argsparameter: aclap::Argsstruct with the application’s arguments - A
contextparameter: theContextfor emitting events and cooperative shutdown - A
projectionparameter: theProjectionfor querying accumulated state
§Attributes
alias = "name"- Add a visible alias for the application. Can be repeated.require_subcommand- Require a subcommand; show help if invoked without one.
§Examples
ⓘ
use clawless::prelude::*;
use clawless::tui::projection::Projection;
#[derive(Debug, Args)]
pub struct DashboardArgs {
#[arg(short, long, default_value = "3000")]
port: u16,
}
/// Interactive project dashboard
#[application]
pub async fn dashboard(
args: DashboardArgs,
context: Context,
projection: Projection,
) -> CommandResult {
Ok(())
}