You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BREAKING CHANGE: Add confirmation prompts and examples for Remove- functions (#174)
Updates all Remove-* functions to set `ConfirmImpact='High'`, wraps the execution in `$PSCmdlet.ShouldProcess()`, and adds examples which show how to call the functions with `-Confirm:$false` to avoid the confirmation prompt.
## Breaking Change
This will be considered a breaking change for anyone using this module in an automated, scripted basis and calling any Remove-* methods. They will need to add `-Confirm:$false` to those API calls, similar to what was done for the unit tests.
Fixes#171
Copy file name to clipboardExpand all lines: GitHubAssignees.ps1
+22-14Lines changed: 22 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -328,11 +328,16 @@ function Remove-GithubAssignee
328
328
Remove-GithubAssignee -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Assignee $assignees
329
329
330
330
Lists the available assignees for issues from the Microsoft\PowerShellForGitHub project.
331
+
332
+
.EXAMPLE
333
+
Remove-GithubAssignee -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Assignee $assignees -Confirm:$false
334
+
335
+
Lists the available assignees for issues from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
331
336
#>
332
337
[CmdletBinding(
333
338
SupportsShouldProcess,
334
-
DefaultParameterSetName='Elements')]
335
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
339
+
DefaultParameterSetName='Elements',
340
+
ConfirmImpact="High")]
336
341
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter","", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
337
342
param(
338
343
[Parameter(ParameterSetName='Elements')]
@@ -374,17 +379,20 @@ function Remove-GithubAssignee
Copy file name to clipboardExpand all lines: GitHubComments.ps1
+20-12Lines changed: 20 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -452,12 +452,17 @@ function Remove-GitHubComment
452
452
Remove-GitHubComment -OwnerName Microsoft -RepositoryName PowerShellForGitHub -CommentID 1
453
453
454
454
Deletes a Github comment from the Microsoft\PowerShellForGitHub project.
455
+
456
+
.EXAMPLE
457
+
Remove-GitHubComment -OwnerName Microsoft -RepositoryName PowerShellForGitHub -CommentID 1 -Confirm:$false
458
+
459
+
Deletes a Github comment from the Microsoft\PowerShellForGitHub project without prompting confirmation.
455
460
#>
456
461
[CmdletBinding(
457
462
SupportsShouldProcess,
458
-
DefaultParameterSetName='Elements')]
463
+
DefaultParameterSetName='Elements',
464
+
ConfirmImpact="High")]
459
465
[Alias('Delete-GitHubComment')]
460
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
461
466
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter","", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
462
467
param(
463
468
[Parameter(ParameterSetName='Elements')]
@@ -491,16 +496,19 @@ function Remove-GitHubComment
Copy file name to clipboardExpand all lines: GitHubLabels.ps1
+43-27Lines changed: 43 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -316,11 +316,16 @@ function Remove-GitHubLabel
316
316
Remove-GitHubLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel
317
317
318
318
Removes the label called "TestLabel" from the PowerShellForGitHub project.
319
+
320
+
.EXAMPLE
321
+
Remove-GitHubLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Confirm:$false
322
+
323
+
Removes the label called "TestLabel" from the PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
319
324
#>
320
325
[CmdletBinding(
321
326
SupportsShouldProcess,
322
-
DefaultParameterSetName='Elements')]
323
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
327
+
DefaultParameterSetName='Elements',
328
+
ConfirmImpact="High")]
324
329
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter","", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
@@ -865,11 +873,16 @@ function Remove-GitHubIssueLabel
865
873
Remove-GitHubIssueLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Issue 1
866
874
867
875
Removes the label called "TestLabel" from issue 1 in the PowerShellForGitHub project.
876
+
877
+
.EXAMPLE
878
+
Remove-GitHubIssueLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Issue 1 -Confirm:$false
879
+
880
+
Removes the label called "TestLabel" from issue 1 in the PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
868
881
#>
869
882
[CmdletBinding(
870
883
SupportsShouldProcess,
871
-
DefaultParameterSetName='Elements')]
872
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
Copy file name to clipboardExpand all lines: GitHubMilestones.ps1
+20-12Lines changed: 20 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -500,12 +500,17 @@ function Remove-GitHubMilestone
500
500
Remove-GitHubMilestone -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Milestone 1
501
501
502
502
Deletes a Github milestone from the Microsoft\PowerShellForGitHub project.
503
+
504
+
.EXAMPLE
505
+
Remove-GitHubMilestone -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Milestone 1 -Confirm:$false
506
+
507
+
Deletes a Github milestone from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
503
508
#>
504
509
[CmdletBinding(
505
510
SupportsShouldProcess,
506
-
DefaultParameterSetName='Elements')]
511
+
DefaultParameterSetName='Elements',
512
+
ConfirmImpact="High")]
507
513
[Alias('Delete-GitHubMilestone')]
508
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
509
514
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter","", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
Copy file name to clipboardExpand all lines: GitHubProjectCards.ps1
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -370,7 +370,6 @@ function Remove-GitHubProjectCard
370
370
SupportsShouldProcess,
371
371
ConfirmImpact='High')]
372
372
[Alias('Delete-GitHubProjectCard')]
373
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification ="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
374
373
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter","", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
Copy file name to clipboardExpand all lines: GitHubProjectColumns.ps1
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -266,7 +266,6 @@ function Remove-GitHubProjectColumn
266
266
SupportsShouldProcess,
267
267
ConfirmImpact='High')]
268
268
[Alias('Delete-GitHubProjectColumn')]
269
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification ="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
270
269
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter","", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
Remove project with ID '4387531' without prompting for confirmation.
472
+
468
473
.EXAMPLE
469
474
$project = Get-GitHubProject -OwnerName Microsoft -RepositoryName PowerShellForGitHub | Where-Object Name -eq 'TestProject'
470
475
Remove-GitHubProject -Project $project.id
@@ -476,7 +481,6 @@ function Remove-GitHubProject
476
481
SupportsShouldProcess,
477
482
ConfirmImpact='High')]
478
483
[Alias('Delete-GitHubProject')]
479
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification ="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
480
484
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter","", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
Remove repository with the given URI, without prompting for confirmation.
220
225
#>
221
226
[CmdletBinding(
222
227
SupportsShouldProcess,
223
-
DefaultParameterSetName='Elements')]
228
+
DefaultParameterSetName='Elements',
229
+
ConfirmImpact="High")]
224
230
[Alias('Delete-GitHubRepository')]
225
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
226
231
param(
227
232
[Parameter(ParameterSetName='Elements')]
228
233
[string] $OwnerName,
@@ -250,18 +255,20 @@ function Remove-GitHubRepository
0 commit comments