| Crates.io | clawless |
| lib.rs | clawless |
| version | 0.2.0 |
| created_at | 2025-06-20 19:33:43.112193+00 |
| updated_at | 2025-07-11 09:46:44.818888+00 |
| description | A framework for building command-line applications |
| homepage | |
| repository | https://github.com/aonyx-rs/clawless.git |
| max_upload_size | |
| id | 1720097 |
| size | 19,196 |
clawless is a framework for building command-line applications with Rust. Its
goal is to provide high-level building blocks and well-designed conventions so
that users can focus on their applications.
The library exports a few macros that create a command-line application, parse arguments, and then call user-defined functions.
Clawless is in a very early prototyping phase and not considered ready for production use. Follow the project and check out the open issues to understand the crate's current limitations.
First of all, generate a new binary crate using cargo new --bin <name>. Inside
the crate, open src/main.rs and replace the generated contents with the
following snippet:
use clawless::clawless;
mod commands;
fn main() {
clawless!()
}
Go ahead and create the src/commands.rs module, and add the following line to
set up the Clawless application:
clawless::app!();
You can now start adding commands to the application by creating submodules in
commands, adding a function, and tagging it as a command.
First, register a new submodule in src/commands.rs:
pub mod command;
Create src/commands/command.rs, and then add a struct and a function to the
file:
use clap::Args;
use clawless::command;
#[derive(Debug, Args)]
pub struct CommandArgs {
#[arg(short, long)]
name: String,
}
#[command]
pub async fn command(args: CommandArgs) {
println!("Running a command: {}", args.name);
}
You can execute the command by calling your command-line application:
cargo run -- command
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.