-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change help message when prompt is skippable #143
Comments
A quick solution might be the following, since a good solution requires a complex remodeling process, but it is so dirty that I dare not open a PR pub fn prompt_skippable(self) -> InquireResult<Option<T> {
if self.help_message == DEFAULT_HELP_MESSAGE {
self.help_message = Some(DEFAULT_HELP_MESSAGE.unwrap() + ", ESC to select none")
}
match self.prompt() {
Ok(response) => Ok(Some(response)),
Err(InquireError::OperationCanceled) => Ok(None),
Err(err) => Err(err),
}
if self.help_message == DEFAULT_HELP_MESSAGE {
self.help_message = DEFAULT_HELP_MESSAGE
}
} |
It's probably going to be a breaking change, but I think it'll lead to a better design for the long-term anyway. What do you think of changing |
I had a look at your PR and I do believe that a new enum |
Let me know if I can help in any way |
Yeah I see what you mean, it was at that point I decided to call it a day lol, will work more on it tonight |
So @dariocurr here's what I'm thinking, it's going to be an actual brain dump here so don't expect a coherent stance, just me thinking out loud and see what your opinions are. Firstly, there is no change in behaviour when the prompt is or isn't skippable. On both cases, the I was thinking a bit more on each of the prompts, on what needs to be done for a happy path to allow "optional input":
The thing is that there can be two semantical constructs here: 1. actively skipping a prompt; 2. giving an empty-like response. It seems you're trying to achieve 2 (based on the error message you suggested), in that you want
Maybe what we do want is to allow What prompted all of these thoughts is that, when thinking of the new error message, I had Concluding here, I don't have a conclusion, and not even a preference for now tbh. I want to find a good, long-term, design that's actually well-planned as the next inquire's release will be v1.0. And for that I'm willing to take some liberty in new design and architectural changes. |
cc @IniterWorker you might be interested in the skip vs empty input discussion |
Please complete the following tasks
Inquire Version
0.6
Describe your use case
When using the skippable prompt I get the same help message as the classic prompt
Describe the solution you'd like
For example when I use a
Select
, the prompt help message is:"↑↓ to move, enter to select, type to filter"
Then when I use a
Select
, the skippable prompt help message should be something like this:"↑↓ to move, enter to select, type to filter, ESC to select none"
Additional Context
I would like to contribute, but I guess I need some guidelines
The text was updated successfully, but these errors were encountered: