It provides several different prompts in order to interactively ask the user for information via the CLI. With inquire, you can use:
Textto 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;Selectto ask the user to select one option from a given list;MultiSelectto ask the user to select an arbitrary number of options from a given list;Confirmfor simple yes/no confirmation prompts;CustomTypefor text prompts that you would like to parse to a custom type, such as numbers or UUIDs;Passwordfor secretive text prompts.
Demo
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
Textprompts; - Custom list filters for Select and
MultiSelectprompts; - Custom parsers for
ConfirmandCustomTypeprompts; - Custom extensions for files created by
Editorprompts; - and many others!
Usage
Put this line in your Cargo.toml, under [dependencies].
= "0.9.1"
* This prompt type is gated under a feature flag, e.g.:
= { = "0.9.1", = ["date", "editor"] }
Derive Macros
For enum types, you can use the Selectable derive macro from the inquire-derive crate to automatically generate Select and MultiSelect prompts:
Add this to your Cargo.toml:
= "0.9.1"
= "0.9.0"