-
-
Notifications
You must be signed in to change notification settings - Fork 515
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
Text prompt with editable default value #595
Comments
@digitaldias It would make sense to add something like that. @spectreconsole/maintainers What do you think? |
I like the idea. I think new TextPrompt<string>("What's your [green]favorite fruit[/]?")
.InvalidChoiceMessage("[red]That's not a valid fruit[/]")
.InitialValue("Orange")
.AddChoice("Apple")
.AddChoice("Banana")
.AddChoice("Orange")); Should it be possible to set both, the editable default (whatever we call it) and the |
Like the suggestion, I wonder if it would provide a solution to an issue where validation logic is bypassed when when a DefaultValue is set. In my case, I expected to be able to provide a default value but have the validation logic run against it, however, with the TextPrompt, validation is bypassed when using DefaultValue as shown in the TextPrompt code listed below: if (DefaultValue != null)
{
console.Write(IsSecret ? "******" : converter(DefaultValue.Value), promptStyle);
console.WriteLine();
return DefaultValue.Value;
} Love to see this issue move forward in a way that provides flexibility to use validation logic even when providing an initial (or default) value! |
I think a simple option can do it - instead of showing the defaultvalue in front of the prompt it should be shown/inserted in the input buffer after the prompt. Something like DefaultInput = true|false. |
Console input is a chore, it'd be nice to be able to pre-fill the user's answer with a default value so that the user can just hit ENTER to proceed to the next question.
I would love the ability to have a prompt that takes a default value, and that makes that editable to the user, which works on PC, Mac, and Linux.
Please upvote 👍 this issue if you are interested in it.
The text was updated successfully, but these errors were encountered: