cliclack
Beautiful, minimal, opinionated CLI prompts for building interactive Rust command-line apps.
Repository Health
Technical Analysis
CliClack is a Rust library for building beautiful, interactive command-line prompts, inspired by the popular @clack/prompts npm package. It provides a small, ergonomic set of prompt components—text input, password, confirm, single- and multi-select, spinners, progress bars, and styled log messages—that render as a polished, minimal terminal UI with graceful cancellation handling.
Designed around a simple builder-style API, CliClack lets you compose a guided prompt session with intro/outro bookends, per-prompt validation, autocomplete, and full theme customization. It is the go-to choice for Rust CLI authors who want the refined prompt experience of Clack without leaving the Rust ecosystem.
What You Get
- A complete set of interactive prompts: input, password, confirm, select, multiselect, spinner, progress bar, and multi-progress
- A builder-style API with per-prompt validation, placeholders, autocomplete, and multiline editing
- Session bookends via intro/outro and outro_cancel, plus styled non-interactive log messages
- Full theme support for customizing colors, symbols, and rendering across the entire prompt UI
Common Use Cases
- Building interactive project scaffolders and create-* CLI wizards in Rust
- Collecting validated configuration input during a tool’s first-run setup
- Showing progress bars and spinners for long-running command-line operations
- Offering searchable, autocompleted selection menus in developer tooling
Under The Hood
Architecture
CliClack is organized around a central PromptInteraction<T> trait (src/prompt/interaction.rs) that defines the render/handle-event contract every prompt implements; the shared interact() loop reads keystrokes from the terminal via the console crate, drives a State<T> machine (Active/Submit/Cancel/Error), and re-renders the prompt on each Event. Individual components live in their own modules (input.rs, select.rs, multiselect.rs, confirm.rs, password.rs, progress.rs, multiprogress.rs), each exposing both a struct constructor (e.g. Input::new) and a convenience free function (e.g. input()) re-exported from lib.rs. A StringCursor (src/prompt/cursor.rs) manages in-line text editing, while theme.rs centralizes all visual styling behind a swappable Theme trait.
Tech Stack
Written in pure Rust (edition 2021), CliClack builds on a small, focused dependency set: console for terminal I/O and key handling, indicatif for progress bars and spinners, textwrap for terminal-width-aware wrapping, strsim for autocomplete fuzzy matching, once_cell for lazy statics, and zeroize to securely clear password buffers. It has no async runtime and no heavy transitive tree, keeping it lightweight for CLI binaries.
Code Quality
The codebase is cleanly modularized, with each prompt type in its own small file and a shared interaction abstraction that avoids duplication. Unit tests exist for the trickier logic—select.rs, multiselect.rs, theme.rs, and the cursor.rs editing model each carry #[cfg(test)] modules—and error handling flows through io::Result. Public items are documented with runnable doc-examples in lib.rs, and the extensive examples/ directory (17 runnable examples) doubles as integration-level validation.
API Design
The public API is deliberately small and consistent: every prompt follows the same builder().option(...).interact()? shape, and free-function shortcuts mirror the original Clack ergonomics, so getting started takes only a couple of lines. Validation closures, placeholders, and theming are opt-in via chained methods, which keeps the common case terse while leaving room for customization. Doc-comments with compilable examples and a rich examples directory make the learning curve gentle.
Used by 2 apps in this directory
helix-db
Databases
A graph-vector database built from scratch in Rust that unifies graph traversal, vector search, key-value, and relational storage into a single platform for AI applications.
iii
Developer Tools · Devops
Compose, extend, and observe every backend service in real time using three primitives: Workers, Functions, and Triggers.