Fix "command.PromptForConfirmation" to accept "enter" for the "N" default#30769
Merged
LK4D4 merged 1 commit intomoby:masterfrom Feb 6, 2017
Merged
Fix "command.PromptForConfirmation" to accept "enter" for the "N" default#30769LK4D4 merged 1 commit intomoby:masterfrom
LK4D4 merged 1 commit intomoby:masterfrom
Conversation
vdemeester
approved these changes
Feb 6, 2017
Member
vdemeester
left a comment
There was a problem hiding this comment.
LGTM 🐸
/cc @thaJeztah @cpuguy83 @tiborvass @anusha-ragunathan @vieux
cpuguy83
reviewed
Feb 6, 2017
cli/command/plugin/install.go
Outdated
Member
There was a problem hiding this comment.
Can you do the same for plugin/upgrade?
Member
Author
There was a problem hiding this comment.
I searched for all instances of y/N in the code to find this one -- guess that one doesn't include y/N 😄
Changing it now!
…ault This adjusts `command.PromptForConfirmation` in `cli/command/utils.go` to use `bufio`'s `ReadLine` rather than using `fmt.Fscan` for reading input, which makes `<Enter>` properly accept the default value of "No" as one would expect. This new code actually came from `cli/command/plugin/install.go`'s `acceptPrivileges` function, which I've also refactored here to use `command.PromptForConfirmation` as it should. Additionally, this updates `cli/command/plugin/upgrade.go`'s `runUpgrade` function to use `command.PromptForConfirmation` for further consistency. Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
5af525c to
2198b05
Compare
Contributor
|
LGTM |
1 similar comment
Contributor
|
LGTM |
This was referenced Feb 20, 2017
dnephin
pushed a commit
to dnephin/docker
that referenced
this pull request
Apr 17, 2017
Fix "command.PromptForConfirmation" to accept "enter" for the "N" default
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
- What I did
This adjusts
command.PromptForConfirmationincli/command/utils.goto usebufio'sReadLinerather than usingfmt.Fscanfor reading input, which makes<Enter>properly accept the default value of "No" as one would expect.- How I did it
This new code actually came from
cli/command/plugin/install.go'sacceptPrivilegesfunction, which I've also refactored here to usecommand.PromptForConfirmationas it should.- How to verify it
I verified it by running
./bundles/latest/dynbinary-client/docker system pruneand testing different combinations of responses (just<Enter>,y,Y,n,N,bogus), and verifying that onlyyandYtry to reclaim space.- Description for the changelog
y/Nprompts- A picture of a cute animal (not mandatory but encouraged)