inquire

A Rust library for building interactive command-line prompts — text, select, multiselect, confirm, date, and password inputs with validation, autocompletion, and theming.

Library
Cargo
v0.9.4
2,620stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
49/100Fair
Development Activity4
Maintenance44
Community52
Maturity56
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture82
Code Quality85
Innovation68
Learning Curve90

inquire gives Rust CLI authors a batteries-included toolkit for asking users questions interactively at the terminal. Rather than hand-rolling raw terminal input handling, developers reach for one of inquire’s typed prompt structs — Text, Select, MultiSelect, Confirm, CustomType, Password, Editor, or DateSelect — configure it with validators, formatters, help messages, and default values, then call .prompt() to get a strongly-typed answer back.

The library is cross-platform out of the box, running on Linux, macOS, and Windows, and lets consumers swap the underlying terminal backend between crossterm (the default), termion, or console depending on what the rest of their application already depends on. Every prompt type supports fine-grained rendering configuration through a global or per-prompt RenderConfig, so applications can theme colors, prefixes, and checkbox glyphs without touching prompt logic.

Because instantiating a prompt is infallible by design, configuration methods can be chained freely and all fallible behavior is surfaced only when .prompt() is called, returning a Result<T, InquireError>. This keeps call sites clean while still giving callers a well-defined error type — NotTTY, OperationCanceled, OperationInterrupted, IO, or a custom validator error — to match on.

What You Get

  • Eight prompt types out of the box: Text, Select, MultiSelect, Confirm, CustomType, Password, Editor, and DateSelect
  • A choice of terminal backend — crossterm (default), termion, or console — selected via Cargo feature flags to match existing dependencies
  • Custom validators, formatters, and fuzzy-search scoring functions for every prompt, each with sensible built-in defaults
  • A global or per-prompt RenderConfig for theming colors, prefixes, and glyphs without changing prompt logic
  • Built-in autocompletion support for Text prompts and fuzzy filtering (via fuzzy-matcher) for Select/MultiSelect
  • A companion inquire-derive crate for deriving prompt-friendly enum support

Common Use Cases

  • Guided setup wizards for CLI tools that need to collect configuration interactively (project scaffolders, installers)
  • Confirmation prompts before destructive operations in command-line utilities
  • Interactive selection menus for choosing from a dynamic list of options (branches, environments, resources)
  • Structured data entry at the terminal — dates, custom-typed values (UUIDs, numbers), and validated free text
  • Building developer-facing CLIs that need password/secret input without echoing keystrokes to the terminal

Under The Hood

Architecture inquire is organized as a Cargo workspace with three crates: the core inquire library, an inquire-derive proc-macro crate for enum support, and an examples crate. The core library separates concerns cleanly across src/prompts/ (one module per prompt type, each implementing a shared Prompt<Backend> trait defined in prompts/prompt.rs), src/ui/ (the CommonBackend trait, frame_renderer.rs, and terminal-specific input readers), and cross-cutting modules like validator.rs, formatter.rs, and error.rs. The Prompt trait’s prompt() method implements a single event loop shared by every prompt type: read a key, translate it into an Action via Action::from_key, dispatch to submit/handle/pre_cancel hooks, and redraw only when ActionResult::NeedsRedraw is returned — meaning changing the core interaction loop touches one well-isolated file rather than eight duplicated implementations.

Tech Stack The library targets Rust edition 2018 with an MSRV of 1.80.0 (CI pins 1.82.0), and is no_std-adjacent in spirit but pulls in std for I/O. Its terminal backend is pluggable via optional dependencies and Cargo features: crossterm (default), termion, or console, selected with default-features = false. Optional features add chrono for the date prompt, tempfile for the editor prompt, and fuzzy-matcher for fuzzy list filtering. Core always-on dependencies are bitflags, dyn-clone, unicode-segmentation, and unicode-width for correct Unicode-aware rendering. Errors are represented as a hand-rolled InquireError enum rather than depending on thiserror in the core crate.

Code Quality The crate has 18+ dedicated test files covering individual prompt behaviors (select/test.rs, multiselect/test.rs, etc.) using rstest for parameterized cases, plus doctests enabled on the main library target. CI (build.yml) runs cargo fmt --check, cargo clippy --workspace --all-features -- -D warnings, and a full test matrix across MSRV/stable Rust on Ubuntu, macOS, and Windows — giving strong confidence the library behaves consistently cross-platform. Public API surfaces carry extensive /// doc comments (170+ in the Select prompt module alone), and a CONTRIBUTING.md documents the expected workflow.

API Design The builder-style API keeps construction infallible and chainable (Text::new("...").with_validator(...).with_help_message(...)), deferring all error handling to a single .prompt() call site. Sensible defaults mean a one-line Text::new("question").prompt()? works immediately, while power users can layer on custom validators, formatters, scoring functions, and a global RenderConfig without changing call sites. Feature-gating expensive optional prompts (date, editor) and terminal backends keeps the default dependency footprint small for consumers who only need text/select/confirm prompts.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search