Originally published byDev.to
Most Rust CLIs today are built with clap—and for good reason. It’s powerful, flexible, and deeply integrated with Rust.
But there’s another approach worth exploring.
Two ways to define a CLI
clap (code-first)
#[derive(Parser)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
You define your CLI structure directly in Rust.
tkucli (config-first)
[[resource]]
name = "users"
[[resource.operation]]
verb = "list"
You define your CLI as a schema, and the framework generates the rest.
Key differences
| clap | tkucli | |
|---|---|---|
| Definition | Rust code | cli.toml |
| Structure | Command tree | Resource → operation |
| Changes | Edit code | Edit config |
| Boilerplate | Manual | Generated |
| TUI | External | Built-in |
What this changes
With clap, your CLI is part of your code.
With tkucli, your CLI becomes data that drives your code.
That enables:
- clearer separation between interface and logic
- easier structural changes
- a shared definition for CLI and TUI
When each works well
clap
- You want full control in Rust
- Your CLI is stable
- You prefer explicit code
tkucli
- Your CLI evolves frequently
- You want a declarative structure
- You like separating interface from implementation
Takeaway
These aren’t competing so much as different design choices:
- clap → code-first CLI
- tkucli → schema-driven CLI
If you’ve only used one style, it’s worth trying the other—you might find it fits certain projects better.
Project
🇺🇸
More news from United StatesUnited States
NORTH AMERICA
Related News
Amazon Employees Are 'Tokenmaxxing' Due To Pressure To Use AI Tools
20h ago
UCP Variant Data: The #1 Reason Agent Checkouts Fail
6h ago

Décryptage technique : Comment builder un téléchargeur de vidéos Reddit performant (DASH, HLS & WebAssembly)
16h ago
How Braze’s CTO is rethinking engineering for the agentic area
10h ago
Encryption Protocols for Secure AI Systems: A Practical Guide
20h ago