Skip to content
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

Update-PSKoan - Fix "Yes to All" for ShouldProcess Prompts #292

Merged
merged 3 commits into from
Oct 21, 2019

Conversation

vexx32
Copy link
Owner

@vexx32 vexx32 commented Oct 20, 2019

PR Summary

Currently, Update-PSKoan prompts for every file updated, even if the user selects "A" for "Yes to All" at one of the prompts.

Fix is to have the ShouldProcess check only in the iterating function, and allow the child function to use that preference instead of checking each time it is called.

Context

The reason this is needed appears to be that "yes to all" is only respected for the duration of the current function. Since Update-PSKoanFile was being called once for every file that needed updating, the prompt was unable to remember the user's selection from the prior call.

Moving the ShouldProcess test into the parent Update-PSKoan function appears to resolve the issue most neatly.

Changes

  • Move $PSCmdlet.ShouldProcess() test from Update-PSKoanFile itself into Update-PSKoan and test before calling the private function.

Checklist

  • Pull Request has a meaningful title.
  • Summarised changes.
  • Pull Request is ready to merge & is not WIP.
  • Added tests / only testable interactively.
    • Make sure you add a new test if old tests do not effectively test the code changed.
  • Added documentation / opened issue to track adding documentation at a later date.

Currently, Update-PSKoan prompts for every file updated,
even if the user selects "A" for "Yes to All"
Fix is to have the ShouldProcess check only in the iterating function,
and allow the child function to use that preference instead of checking
@vexx32 vexx32 added PR-Needs-Review 🔍 Let's take a closer look! Category-Module Pertaining to the module's functionality itself. labels Oct 20, 2019
@vexx32 vexx32 self-assigned this Oct 20, 2019
@vexx32 vexx32 added this to In Progress in Module Features / Bugfixes Progress via automation Oct 20, 2019
@vexx32
Copy link
Owner Author

vexx32 commented Oct 20, 2019

@indented-automation mind giving this one a looksee for me? 💖 😊

@indented-automation
Copy link
Contributor

Looks good to me. Good change :)

@vexx32 vexx32 merged commit 29fd4d1 into master Oct 21, 2019
Module Features / Bugfixes Progress automation moved this from In Progress to Closed Oct 21, 2019
@vexx32 vexx32 deleted the UpdatableKoans/ShouldProcess branch October 21, 2019 10:21
@vexx32 vexx32 removed the PR-Needs-Review 🔍 Let's take a closer look! label Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category-Module Pertaining to the module's functionality itself.
Development

Successfully merging this pull request may close these issues.

None yet

2 participants