-
Notifications
You must be signed in to change notification settings - Fork 905
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
#185 Remove default choice from InteractivePrompt.prompt_for_confirmation
and all associated tests
#199
Conversation
@christianrondeau can I get you to have a read of our Contributing document, specifically this section: https://github.com/chocolatey/choco/blob/master/CONTRIBUTING.md#prepare-commits Thanks |
@gep13 I did, and carefully :) I was unsure of my pull request especially because of all removed associated tests. I guess this is why you are referring me to the Since the issue was about removing the defaults everywhere, I thought of removing the functionality instead of changing only usages; many tests were written specifically to handle defaults; I did a minimal cleanup (which happens to be quite a lot). I also saw that So, I had two choices: either I only changed the calls to I usually preferred the latter, but if you prefer the former, I can certainly reissue a pull request and do that in the future. Let me know! |
The main thing that I was referring to was this:
As I noticed that the commit message was wrapping around: I am not yet clear on how stringent @ferventcoder is going to be about things like this 😸 |
I hadn't actually looked at the contents of the PR from a review perspective, I was just trying to pre-empt a possible issue that you might be called on 😸 |
My biggest issue is the removing of code from infrastructure. The infrastructure section is general purpose items that could be pulled out and into other things or their own things. I'd rather see adding additional items to the general purpose area. Almost all of the work here could have been done by simple changes to the parameters passed. One could add an application specific prompt setup that the app would call instead that will call the general purpose one with the specific setup, if that makes sense. |
@gep: Thanks, I'll re-issue the commits with shorter names. @ferventcoder: So you are saying: keep the "unused" code, as it is infrastructure code and may be used for other purposes in the future. Is this correct? I would not create an application-specific wrapper just for this then, I'd simply pass I'll try to avoid "cleaning up" after myself in future pull requests when the code is in the PR coming up in a few hours (when I have some free time) |
Yes, I think you have stated that correctly. I think you'd still want |
@ferventcoder Correct for |
171888f
to
f91a3c9
Compare
Here is another (much simpler) pull request. Note that because there was no tests for default options, I didn't write any. I did verify it worked on a build though :) I kept the two commits with the tests cleanup, just in case: https://github.com/christianrondeau/choco/tree/185-no-prompt-default-failed-pr-1 Let me know if that's better. If you'd prefer that I add tests, let me know. |
Always prefer tests :) On Tuesday, March 24, 2015, Christian Rondeau [email protected]
Rob http://devlicio.us/blogs/rob_reynolds |
@ferventcoder I guessed so, I do too 👍 Though in that case I'm not sure how to proceed. Since there was no test verifying that the "default" did indeed work, and since I only removed a feature, not only I have no new tests to write, but I also have no tests to update or remove 😛. The behavior of |
I didn't have any tests verifying using the default? Gah, happens when you On Tuesday, March 24, 2015, Christian Rondeau [email protected]
Rob http://devlicio.us/blogs/rob_reynolds |
@@ -194,7 +194,7 @@ private static void warn_when_admin_needs_elevation(ChocolateyConfiguration conf | |||
elevated shell. When you open the command shell, you should ensure | |||
that you do so with ""Run as Administrator"" selected. | |||
|
|||
Do you want to continue?", new[] {"yes", "no"}, "no", requireAnswer: true); | |||
Do you want to continue?", new[] { "yes", "no" }, defaultChoice: null, requireAnswer: true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I'm +1 on merging this, with possibly fixing the rollback prompt. That's one that seems like it would have a default choice. Thoughts? |
My humble opinion would be to avoid defaults altogether. Here is my rationale:
This being said, those are my only arguments 😄. If you still believe the default value to be preferable, let me know and I'll change the PR to bring back the default option for this specific case. |
Merged into stable at e992c4f and will be released in 0.9.9.5. |
Resolves #185 (Do not offer a default option when prompting for a user choice).
Note that it simply removes the code in
interactivePrompt
fordefaultValue
(first commit) andrequireValue
(second commit) since nowhere in the code other than in tests was the value actually optional. Most of the changes other than that are tests that don't make sense anymore (e.g. all tests for optional/default prompts).This is my first pull request for this project, so feel free to suggest changes to how I make these (e.g. leave all tests and ask), since I plan on doing a few more. All tests are green!