I built a declarative CLI framework in Rust (define your CLI in TOML)
Most Rust CLI tools are built with libraries like clap. They’re powerful—but also verbose.
After building a few internal tools, I kept running into the same problem:
- Too much boilerplate for simple commands
- Repeating argument parsing logic
- Hard to manage growing CLI complexity
So I built tkucli — a declarative CLI framework for Rust.
🧠 The idea
Instead of writing Rust code to define commands, you describe your CLI in a TOML file.
You define:
- commands
- arguments
- workflows
…and the framework handles execution.
✨ Example
Define a command:
[app]
name = "vm-cli"
version = "0.1.0"
description = "A Tkucli-powered CLI"
default_output = "table"
[tui]
enabled = true
theme = "dark"
[[resource]]
name = "vm"
description = "VM resource — replace with your own"
[[resource.operation]]
verb = "create"
description = "create a vm"
args = [{ name = "name", type = "string", required = true }]
[[resource.operation]]
verb = "list"
description = "List all examples"
flags = [
{ name = "limit", short = "n", type = "u32", default = "20", help = "Max results" },
]
[[resource.operation]]
verb = "get"
description = "Get a vm by name"
args = [{ name = "name", type = "string", required = true }]
[[resource.operation]]
verb = "delete"
description = "Get a vm by name"
args = [{ name = "name", type = "string", required = true }]
Run it:
tkucli vm-cli vm create --name first-vm
🚀 Why I built this
I wanted something that feels like:
- Infrastructure-as-Code, but for CLI
- Easy to extend (TUI, workflows, automation)
- Great for internal tools / DevOps / homelabs
🔄 How it compares
-
clap→ full control, but code-heavy -
bash→ quick, but messy at scale - tkucli → structured, declarative, fast to build
🧩 Use cases
- Wrapping tools like Ansible / Terraform
- Internal developer platforms
- Automation CLIs
- Homelab management
⚠️ What it’s NOT
This isn’t trying to replace low-level CLI frameworks.
If you need:
- very custom parsing
- maximum performance
→ use
clap
💡 What I’m exploring next
- Built-in TUI support (ratatui-style)
- Better workflow composition
- Git-backed CLI configs
🙌 Looking for feedback
I’m trying to answer a simple question:
What if building a CLI felt like writing a config, not a program?
Curious if this resonates with others building tools in Rust.
- Does this solve a real pain for you?
- Would you use something like this?
Happy to share repo / details if there’s interest.
This article was originally published by DEV Community and written by kuangren chu.
Read original article on DEV Community