- Upgraded underlying
crossterm
crate from v0.25 to v0.26. - Upgraded underlying
termion
crate from v1.5 to v2.0. - Upgraded underlying
bitflags
from v1 to v2, which affects theAttributes
andKeyModifiers
crates. If you use any of bitflag's methods directly, you might be affected, refer to the bitflags changelog for more information.
0.6.1 - 2023-04-08
0.6.0 - 2023-03-03
- Selected option can now be styled independently of other options through
RenderConfig::with_selected_option()
. - Now selected options are highlighted cyan by default.
- Output dialogs on
stderr
instead ofstdout
#89. - New Minimum Supported Rust Version: 1.58.1.
0.5.3 - 2023-01-09
- Addition of
with_starting_date(NaiveDate)
toDateSelect
prompts.- Equivalent to
with_default(NaiveDate)
, but with a more descriptive name.
- Equivalent to
0.5.2 - 2022-11-01
- Fixed typo in the default error message when a password confirmation does not match. Thanks to @woodruffw for the PR! #79
- Releases containing the typo: v0.5.0 and v0.5.1.
0.5.1 - 2022-10-31
- Removed use of
bool::then_some
feature to keep minimum supported Rust version on 1.56.0.
0.5.0 - 2022-10-31
Password
prompts now enable a secondary confirmation prompt by default:
- Added support for password confirmation, which can be oupted-out of by adding the
without_confirmation()
method into thePassword
builder chain. Thanks to @hampuslidin for the PR! #73
0.4.0 - 2022-09-27
Multiple changes to the CustomType
prompt:
- Added support for validators, separating concerns between parsing and validating parsed values.
- Decoupled default value formatting from the default value property. Now you can set default values without a specific formatter to accompany them.
- Input is not cleared anymore when the parsing or validation fails.
New autocompletion mechanism for Text
prompts
- Existing methods still work, you just have to update
with_suggester
calls towith_autocomplete
. - To know more about the new possibilities, check the updated documentation on the repository's README.
- Added shorthand method
rgb(r: u8, g: u8, b: u8)
to create aColor
struct from RGB components. Thanks to @tpoliaw for the PR! #73
0.3.0 - 2022-08-19
Features #1 to #4 are all breaking changes and could break the compilation of your program.
Fix #2 representes a change in usability and might be an unexpected behavior.
Completer
for Text
prompts, allowing users to auto-update their text input by pressing tab
and not having to navigate through a suggestion list.
It takes the current input and return an optional suggestion. If any, the prompter will replace the current input with the received suggestion. Completer
is an alias for &'a dyn Fn(&str) -> Result<Option<String>, CustomUserError>
.
The auto-completion API will be revamped for v0.4.0, watch #69.
Added answered_prompt_prefix
configuration on RenderConfig
, allowing users to set custom prefixes (e.g. a check mark) to prompts that have already been answered.
Additionally, prompts that have been answered are now differed by a >
prefix instead of the usual ?
.
Cheers to @href for the suggestion! #44
Input validation, suggestions and completions are now fallible operations.
The return type of validators has been changed to Result<Validation, CustomUserError>
. This means that validating the input can now be a fallible operation. The docs contain more thorough explanations and full-featured examples.
- Successful executions of the validator should return a variant of the
Validation
enum, which can be eitherValid
orInvalid(ErrorMessage)
. - Unsuccessful executions return a
CustomUserError
type, which is an alias forBox<dyn std::error::Error + Send + Sync + 'static>
.
The return type of suggesters has also been changed to allow fallible executions. The return type in successful executions continues to be Vec<String>
, while CustomUserError
is used with errors.
All builtin validators have been turned into traits, with structs instead of macros as implementations.
This change makes it easier to share the validators throughout the code, especially if these carry their own owned data. For example, consider a validator that uses a compiled regular expression to verify the input. That validator can now be built as a new-type struct that encapsulates the regex.
Closures can still be used as before, but may not require to pass the argument type explicitly. The previous macros are now simply shorthands for the constructors of builtin validators.
- Fix a broken link in the
struct.Text
documentation. - Suggestions are now always loaded at the start of a
Text
prompt.- Previously, suggestions were only loaded and displayed if the
Text
prompt was created with a pre-existing input value or after the user entered any input. - Now, even if the prompt is started without any input and the user hasn't done anything, suggestions are displayed.
- Previously, suggestions were only loaded and displayed if the
- Update
crossterm
andconsole
to their latest versions.
0.2.1 - 2021-10-01
- Add
initial_value
property toText
prompts, which sets an initial value for the prompt's text input. Huge thanks to @irevoire for the suggestion and implementation. #34.
- Multiple changes to fix general warnings appearing throughout the code.
0.2.0 - 2021-09-14
- Add
inquire::set_global_render_config
method to set a global RenderConfig object to be used as the default one for all prompts created after the call. - Add KEY_BINDINGS.md to register all key bindings registered by
inquire
prompts.
RenderConfig
was madeCopy
-able and prompts now contain aRenderConfig
field where it previously held a&'a RenderConfig
. Consequently,with_render_config()
methods now accept aRenderConfig
argument instead of&'a RenderConfig
.
0.1.0 - 2021-09-14
No changes in this version.
This is a bump to v0.1.0 as per @jam1garner's advice on the Virtual RustConf Discord server.
The library is already featureful enough to warrant a higher version number, bumping us to a minor release while we are still on our path to stabilization.
0.0.11 - 2021-09-06
- Add
Editor
prompt. - Add support to use
console
ortermion
as the library to handle terminals while keepingcrossterm
as the default choice. - Canceling the prompt by pressing
ESC
is now a different behavior than interrupting the prompt by pressingCtrl+C
.- If the prompt is canceled, the final prompt render indicates to the user that it was canceled via a
<canceled>
text, which is customizable via RenderConfig, and the prompt method returnsErr(InquireError::OperationCanceled)
. - If the prompt is interrupted, the only clean-up action done is restoring the cursor position, and the prompt method returns
Err(InquireError::OperationInterrupted)
.
- If the prompt is canceled, the final prompt render indicates to the user that it was canceled via a
- Add a
prompt_skippable
method for all prompts.- This method is intended for flows where the user skipping/cancelling the prompt - by pressing ESC - is considered normal behavior. In this case, it does not return
Err(InquireError::OperationCanceled)
, butOk(None)
. Meanwhile, if the user does submit an answer, the method wraps the return type withSome
.
- This method is intended for flows where the user skipping/cancelling the prompt - by pressing ESC - is considered normal behavior. In this case, it does not return
- Removed need to add
use inquire::validator::InquireLength
when using one of the length-related built-in validators. - Cursor should not ficker anymore in wrong positions on
Windowsslower terminals. - Documentation on the
Color
enum used for render configuration has been improved.
- Fix dependencies the crate had on macros provided by the
builtin_validators
feature, making it now compile when the feature is not turned on.
0.0.10 - 2021-08-29
- Use native terminal cursors in text inputs by default.
- Use native terminal cursor on date prompts when an optional style sheet for the selected cursor token was defined as
None
. The default behavior is still a custom style sheet which highlights the two columns pertaining to a date, instead of using a native cursor which can only highlight one column. - Respect NO_COLOR environment variable when prompt uses the default render configuration.
- By using a new method to identify the length of the rendered prompt, we avoid possible rendering errors (edge cases) when a string can not render into a single line in the terminal due to a smaller width. Inner calculations could previously predict that the rendered string would fit, by considering that 1 grapheme = 1 column width, but this is not true for e.g. emojis. Now we use unicode_width to fix this behavior.
- Fixed case where Select/MultiSelect prompts were panicking when a user pressed the down arrow on an empty list, which happens when a filter input does not match any options. #30
- Fixed incorrect indexes on the output of MultiSelect prompts, where the indexes inside a
ListOption
struct were relative to the output instead of the original input vector. #31 - Fixed case where IO errors due to not finding a tty devices were not being catched and transformed to
InquireError::NotTTY
. #28
0.0.9 - 2021-08-28
- Improve docs on the differences between
raw_prompt
andprompt
on Select and MultiSelect prompts. - Bump version of
crossterm
dependency
- Regression introduced on v0.0.8 where select prompts were panicking when user pressed enter while no options were displayed (due to filter input). Tracked by #29 and tests were added for this to not happen again.
0.0.8 - 2021-08-25
- Password display toggle: By enabling this option in
Password
prompts viawith_display_toggle_enabled()
, the application user can choose to display the current text input for the password by pressingCtrl+R
, and hide it back by pressing the hotkey again. #18 - Render mask of password input:
Password
prompts now support another render mode of the text input. Before, the only behavior was to not render anything about the current password input. Now, if the developer so chooses, they can activate theMasked
mode where the current text input will be masked with special characters such as'*'
. #19 - PageUp, PageDown, Home and End hotkeys: PageUp and PageDown are now supported in
Select
,MultiSelect
andText
(suggestions list) prompts, where they go a page up or down in the current list. Also, forSelect
andMultiSelect
prompts, the Home and End keys were mapped to go to the start or end of the list, respectively. #17 - Indication that list is scrollable: Now option lists, present in
Select
,MultiSelect
andText
prompts, indicate whether there are more options other than the ones currently displayed. Little arrows are displayed at the top or bottom of the list indicating to which positions the user can scroll. #8 - Generic option types for Select and MultiSelect prompts: Now,
Select
andMultiSelect
prompts accept any type of options as input, allowing developers to pass a vector of owned objects and get back the full object picked by the user. #9
- Handling of new-line characters in user-provided strings: When putting
\n
on strings such as prompt messages, the library previously did not render it very well and did not account for it when cleaning the current prompt. This is fixed and you are free to create multi-line prompts! #15 - Lines larger than terminal width broke rendering: When lines that were larger than the terminal width were rendered, it caused the internal line counter (used to clean the prompt) to be off, leading to buggy behavior. This was fixed by retrieving the terminal size at the start of the prompt. #21
0.0.7 - 2021-08-20
- Add possibility to set custom rendering config, allowing users to set:
- Custom colors
- Custom prefixes for several prompts
- Custom checkboxes
- Add "placeholder" feature for prompts with text input
0.0.6 - 2021-07-26
- Add [previously non-existing] documentation.
- Add CustomType prompt
- Add revamped auto-completion support for Text prompts
0.0.5 - 2021-07-19
- All function arguments now accept closures by having their type changed to
&dyn Fn
. - Improved input UX
- Cursor added for better editing experience
- Features/shortcuts added: Ctrl+Left, Ctrl+Right, Home, End, Delete, Ctrl+Delete
0.0.4 - 2021-07-14
- Add a custom error enum
InquireError
, improving error handling for library users. - Improve support for validator functions, allowing the use of closures.
- Change the terminal back-end from termion to crossterm, adding Windows support for this library.
0.0.3 - 2021-07-07
- Reduce package footprint
- Add custom parser option to Confirm prompt
- Add DateSelect prompt
- Wasn't documented :)