-
Notifications
You must be signed in to change notification settings - Fork 903
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
When prompting for a user yes/no answer, use a short [y/n] representation #181
Comments
Allows the same behavior as prompt_for_confirmation, but in a short display. Example: `Do you want to continue? (yes/no): `
Hi, This has been almost fully implemented, but a single detail. See: https://github.com/christianrondeau/choco/blob/22af53bac95cd701cfcc81c7a2a6ef39ceb4cfbb/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs#L58 (Line 58 and 60) There is a
If you know a better way to achieve this, let me know. For more details, here is my branch: https://github.com/christianrondeau/choco/tree/181-short-confirm-prompt |
Well it looks like it's impossible with log4net. I will then do the direct to console approach, and output the selection after, i.e. (simplified): Console.Write("prompt: "); This means that either 1. We don't see the prompt message in the log, or b. We see it twice in the console. Unless we create a "prompt" logger, which would behave like the normal logger, without the console appender. Is this worth the additional complexity? |
maybe... |
@ferventcoder: Implemented in #204, I personally think it makes sense; most of chocolatey is just output, but this specific line preceding the readline is part of the prompting. The PR will not print in the log file, just the console; then, when we have the input, we print to the log file, but not the console. It looks good on both sides. |
@ferventcoder I would also love to see a prompt where I can enter And then chocolatey is more 👍 for this. |
@StefanScherer you can enter the value |
This allows using the first value. :) |
@ferventcoder I see. So
|
Right, the |
By the way @ferventcoder if you need anything else from me, just let me know (I know you're swamped with the moderation load) |
No worries, will get this guy in hopefully sometime this month. |
Rebased and merged with #184 (since they are almost the same set of changes) |
Right now, when asking a multiple choice question such as which version to uninstall, there is no indication that a user input is expected. Add an input indicator ">" to make this clearer. Certain questions are spread out across multiple lines when they could be on just one line as a short prompt that include the choices in parentheses. For example, instead of "Do you want to run the script? 1) yes 2) no 3) skip > " it could simply be "Do you want to run the script? (Yes/No/Print): yes". If the prompt allows for short answers, then provide hints that the answer can be a single keystroke. For example "Do you want to run the script? ([Y]es/[N]o/[P]rint): y" In a short prompt, if there is a default answer, surround it with braces as well. For example "Do you want to run the script? ([[Y]es]/[N]o/[P]rint): _"
* stable: (GH-460) Amended Template (GH-623) Extract Nuspec on Install (GH-674)(GH-672) Color Overrides / Fix Write-Host (GH-181) log selection to log file only (GH-181)(GH-184) Short prompt/Prompt character (GH-675) Template include LICENSE/VERIFICATION (GH-258) Rename zip to detector.zip (GH-572) Fix: The handle is invalid - Output Redirection (maint) comments (GH-667) Provide How To Add Profile Manually (GH-667) PowerShell Custom Host - Set $Profile (GH-666) pass Write-ChocolateyError message param (GH-673) Ensure Get-BinRoot Warning is Shown (GH-666) setup logs colored write-host w/fallback
Problem Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): My Problem Sloved Just y |
Here is how yes/no/skip answers are displayed:
Do you want to run the script? NOTE: If you choose not to run the script, the installation will fail. Skip is an advanced option and most likely will never be wanted. 1) yes 2) no [Default - Press Enter] 3) skip
Here is a suggestion of how the prompt could look like:
Do you want to run the script? (Yes/No/Skip): y
In other words: when asking for a yes/no question, use the shorthand, similar to other windows command line tools.
Example:
Overwrite C:\path\file.txt (Yes/No/All)?
For more information: https://groups.google.com/forum/#!topic/chocolatey/UVncL7PxXRg
(Moved from chocolatey-archive/chocolatey#689)
The text was updated successfully, but these errors were encountered: