30 releases

0.7.5 Apr 23, 2024
0.7.4 Mar 25, 2024
0.7.0 Feb 24, 2024
0.6.2 May 7, 2023
0.0.6 Jul 26, 2021

#16 in Command-line interface

Download history 40941/week @ 2024-07-26 36172/week @ 2024-08-02 42291/week @ 2024-08-09 39338/week @ 2024-08-16 40523/week @ 2024-08-23 39918/week @ 2024-08-30 43674/week @ 2024-09-06 38597/week @ 2024-09-13 48093/week @ 2024-09-20 43564/week @ 2024-09-27 49126/week @ 2024-10-04 45775/week @ 2024-10-11 52076/week @ 2024-10-18 50837/week @ 2024-10-25 49648/week @ 2024-11-01 40381/week @ 2024-11-08

201,523 downloads per month
Used in 452 crates (419 directly)

MIT license

485KB
10K SLoC

Latest Version Build status Supported platforms License



inquire is a library for building interactive prompts on terminals.

It provides several different prompts in order to interactively ask the user for information via the CLI. With inquire, you can use:

  • Text to get text input from the user, with built-in autocompletion support;
  • Editor* to get longer text inputs by opening a text editor for the user;
  • DateSelect* to get a date input from the user, selected via an interactive calendar;
  • Select to ask the user to select one option from a given list;
  • MultiSelect to ask the user to select an arbitrary number of options from a given list;
  • Confirm for simple yes/no confirmation prompts;
  • CustomType for text prompts that you would like to parse to a custom type, such as numbers or UUIDs;
  • Password for secretive text prompts.

Demo

Animated GIF making a demonstration of a questionnaire created with this library. You can replay this recording in your terminal with asciinema play command - asciinema play ../assets/expense_tracker.cast Source

Features

  • Cross-platform, supporting UNIX and Windows terminals (thanks to crossterm);
  • Several kinds of prompts to suit your needs;
  • Support for fine-grained configuration for each prompt type, allowing you to customize:
    • Default values;
    • Input validators and formatters;
    • Help messages;
    • Autocompletion for Text prompts;
    • Custom list filters for Select and MultiSelect prompts;
    • Custom parsers for Confirm and CustomType prompts;
    • Custom extensions for files created by Editor prompts;
    • and many others!

Usage

Put this line in your Cargo.toml, under [dependencies].

inquire = "0.7.5"

* This prompt type is gated under a feature flag, e.g.:

inquire = { version = "0.7.5", features = ["date", "editor"] }

Dependencies

~3–12MB
~142K SLoC