Skip to content

Instantly share code, notes, and snippets.

@shaneis
Last active August 29, 2018 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaneis/ef28110ed710609fec227bddd68a7b82 to your computer and use it in GitHub Desktop.
Save shaneis/ef28110ed710609fec227bddd68a7b82 to your computer and use it in GitHub Desktop.
Edit all the things!
#region Test-EditedConfirm
function Test-EditedConfirm {
[CmdletBinding(SupportsShouldProcess,
ConfirmImpact = 'High')]
param(
[int[]]$Numbers
)
process {
foreach ($num in $Numbers) {
if ($PSCmdlet.ShouldProcess("Guess what this does? [$num]",
"Are you sure you want to process: [$num]",
'STOP!')) {
"Current numbers: [$num]"
}
}
}
}
Test-EditedConfirm -Numbers $Numbers
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment