Skip to content

Commit 3c642d2

Browse files
Adding -Force switch to ConfirmImpact=High functions (#226)
Adding -Force switch to ConfirmImpact=High functions and updated affected tests/documentation Fixes #218
1 parent 66dba36 commit 3c642d2

13 files changed

+180
-13
lines changed

Diff for: GitHubAssignees.ps1

+17-2
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ function Remove-GithubAssignee
314314
.PARAMETER Assignee
315315
Usernames of assignees to remove from an issue. NOTE: Only users with push access can remove assignees from an issue. Assignees are silently ignored otherwise.
316316
317+
.PARAMETER Force
318+
If this switch is specified, you will not be prompted for confirmation of command execution.
319+
317320
.PARAMETER AccessToken
318321
If provided, this will be used as the AccessToken for authentication with the
319322
REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.
@@ -327,12 +330,17 @@ function Remove-GithubAssignee
327330
.EXAMPLE
328331
Remove-GithubAssignee -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Assignee $assignees
329332
330-
Lists the available assignees for issues from the Microsoft\PowerShellForGitHub project.
333+
Removes the available assignees for issues from the Microsoft\PowerShellForGitHub project.
331334
332335
.EXAMPLE
333336
Remove-GithubAssignee -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Assignee $assignees -Confirm:$false
334337
335-
Lists the available assignees for issues from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
338+
Removes the available assignees for issues from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
339+
340+
.EXAMPLE
341+
Remove-GithubAssignee -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Assignee $assignees -Force
342+
343+
Removes the available assignees for issues from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Force was specified.
336344
#>
337345
[CmdletBinding(
338346
SupportsShouldProcess,
@@ -357,6 +365,8 @@ function Remove-GithubAssignee
357365
[Parameter(Mandatory)]
358366
[string[]] $Assignee,
359367

368+
[switch] $Force,
369+
360370
[string] $AccessToken,
361371

362372
[switch] $NoStatus
@@ -379,6 +389,11 @@ function Remove-GithubAssignee
379389
'assignees' = $Assignee
380390
}
381391

392+
if ($Force -and (-not $Confirm))
393+
{
394+
$ConfirmPreference = 'None'
395+
}
396+
382397
if ($PSCmdlet.ShouldProcess($Assignee -join ', ', "Remove assignee(s)"))
383398
{
384399
$params = @{

Diff for: GitHubComments.ps1

+15
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ function Remove-GitHubComment
438438
.PARAMETER CommentID
439439
The id of the comment to delete.
440440
441+
.PARAMETER Force
442+
If this switch is specified, you will not be prompted for confirmation of command execution.
443+
441444
.PARAMETER AccessToken
442445
If provided, this will be used as the AccessToken for authentication with the
443446
REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.
@@ -456,6 +459,11 @@ function Remove-GitHubComment
456459
.EXAMPLE
457460
Remove-GitHubComment -OwnerName Microsoft -RepositoryName PowerShellForGitHub -CommentID 1 -Confirm:$false
458461
462+
Deletes a Github comment from the Microsoft\PowerShellForGitHub project without prompting confirmation.
463+
464+
.EXAMPLE
465+
Remove-GitHubComment -OwnerName Microsoft -RepositoryName PowerShellForGitHub -CommentID 1 -Force
466+
459467
Deletes a Github comment from the Microsoft\PowerShellForGitHub project without prompting confirmation.
460468
#>
461469
[CmdletBinding(
@@ -479,6 +487,8 @@ function Remove-GitHubComment
479487
[Parameter(Mandatory)]
480488
[string] $CommentID,
481489

490+
[switch] $Force,
491+
482492
[string] $AccessToken,
483493

484494
[switch] $NoStatus
@@ -496,6 +506,11 @@ function Remove-GitHubComment
496506
'CommentID' = (Get-PiiSafeString -PlainText $CommentID)
497507
}
498508

509+
if ($Force -and (-not $Confirm))
510+
{
511+
$ConfirmPreference = 'None'
512+
}
513+
499514
if ($PSCmdlet.ShouldProcess($CommentID, "Remove comment"))
500515
{
501516
$params = @{

Diff for: GitHubLabels.ps1

+30
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ function Remove-GitHubLabel
302302
Name of the label to be deleted.
303303
Emoji and codes are supported. For more information, see here: https://www.webpagefx.com/tools/emoji-cheat-sheet/
304304
305+
.PARAMETER Force
306+
If this switch is specified, you will not be prompted for confirmation of command execution.
307+
305308
.PARAMETER AccessToken
306309
If provided, this will be used as the AccessToken for authentication with the
307310
REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.
@@ -321,6 +324,11 @@ function Remove-GitHubLabel
321324
Remove-GitHubLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Confirm:$false
322325
323326
Removes the label called "TestLabel" from the PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
327+
328+
.EXAMPLE
329+
Remove-GitHubLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Force
330+
331+
Removes the label called "TestLabel" from the PowerShellForGitHub project. Will not prompt for confirmation, as -Force was specified.
324332
#>
325333
[CmdletBinding(
326334
SupportsShouldProcess,
@@ -345,6 +353,8 @@ function Remove-GitHubLabel
345353
[Alias('LabelName')]
346354
[string] $Name,
347355

356+
[switch] $Force,
357+
348358
[string] $AccessToken,
349359

350360
[switch] $NoStatus
@@ -361,6 +371,11 @@ function Remove-GitHubLabel
361371
'RepositoryName' = (Get-PiiSafeString -PlainText $RepositoryName)
362372
}
363373

374+
if ($Force -and (-not $Confirm))
375+
{
376+
$ConfirmPreference = 'None'
377+
}
378+
364379
if ($PSCmdlet.ShouldProcess($Name, "Remove label"))
365380
{
366381
$params = @{
@@ -859,6 +874,9 @@ function Remove-GitHubIssueLabel
859874
Name of the label to be deleted. If not provided, will delete all labels on the issue.
860875
Emoji and codes are supported. For more information, see here: https://www.webpagefx.com/tools/emoji-cheat-sheet/
861876
877+
.PARAMETER Force
878+
If this switch is specified, you will not be prompted for confirmation of command execution.
879+
862880
.PARAMETER AccessToken
863881
If provided, this will be used as the AccessToken for authentication with the
864882
REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.
@@ -878,6 +896,11 @@ function Remove-GitHubIssueLabel
878896
Remove-GitHubIssueLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Issue 1 -Confirm:$false
879897
880898
Removes the label called "TestLabel" from issue 1 in the PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
899+
900+
.EXAMPLE
901+
Remove-GitHubIssueLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Issue 1 -Force
902+
903+
Removes the label called "TestLabel" from issue 1 in the PowerShellForGitHub project. Will not prompt for confirmation, as -Force was specified.
881904
#>
882905
[CmdletBinding(
883906
SupportsShouldProcess,
@@ -901,6 +924,8 @@ function Remove-GitHubIssueLabel
901924
[Alias('LabelName')]
902925
[string] $Name,
903926

927+
[switch] $Force,
928+
904929
[string] $AccessToken,
905930

906931
[switch] $NoStatus
@@ -928,6 +953,11 @@ function Remove-GitHubIssueLabel
928953
$description = "Deleting all labels from issue $Issue in $RepositoryName"
929954
}
930955

956+
if ($Force -and (-not $Confirm))
957+
{
958+
$ConfirmPreference = 'None'
959+
}
960+
931961
if ($PSCmdlet.ShouldProcess($Name, "Remove label"))
932962
{
933963
$params = @{

Diff for: GitHubMilestones.ps1

+15
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,9 @@ function Remove-GitHubMilestone
486486
.PARAMETER Milestone
487487
The number of a specific milestone to delete.
488488
489+
.PARAMETER Force
490+
If this switch is specified, you will not be prompted for confirmation of command execution.
491+
489492
.PARAMETER AccessToken
490493
If provided, this will be used as the AccessToken for authentication with the
491494
REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.
@@ -505,6 +508,11 @@ function Remove-GitHubMilestone
505508
Remove-GitHubMilestone -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Milestone 1 -Confirm:$false
506509
507510
Deletes a Github milestone from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
511+
512+
.EXAMPLE
513+
Remove-GitHubMilestone -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Milestone 1 -Force
514+
515+
Deletes a Github milestone from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Force was specified.
508516
#>
509517
[CmdletBinding(
510518
SupportsShouldProcess,
@@ -526,6 +534,8 @@ function Remove-GitHubMilestone
526534
[Parameter(Mandatory, ParameterSetName='Elements')]
527535
[string] $Milestone,
528536

537+
[switch] $Force,
538+
529539
[string] $AccessToken,
530540

531541
[switch] $NoStatus
@@ -543,6 +553,11 @@ function Remove-GitHubMilestone
543553
'Milestone' = (Get-PiiSafeString -PlainText $Milestone)
544554
}
545555

556+
if ($Force -and (-not $Confirm))
557+
{
558+
$ConfirmPreference = 'None'
559+
}
560+
546561
if ($PSCmdlet.ShouldProcess($Milestone, "Remove milestone"))
547562
{
548563
$params = @{

Diff for: GitHubProjectCards.ps1

+15
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ function Remove-GitHubProjectCard
346346
.PARAMETER Card
347347
ID of the card to remove.
348348
349+
.PARAMETER Force
350+
If this switch is specified, you will not be prompted for confirmation of command execution.
351+
349352
.PARAMETER AccessToken
350353
If provided, this will be used as the AccessToken for authentication with the
351354
REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.
@@ -364,6 +367,11 @@ function Remove-GitHubProjectCard
364367
.EXAMPLE
365368
Remove-GitHubProjectCard -Card 999999 -Confirm:$False
366369
370+
Remove project card with ID 999999 without prompting for confirmation.
371+
372+
.EXAMPLE
373+
Remove-GitHubProjectCard -Card 999999 -Force
374+
367375
Remove project card with ID 999999 without prompting for confirmation.
368376
#>
369377
[CmdletBinding(
@@ -375,6 +383,8 @@ function Remove-GitHubProjectCard
375383
[Parameter(Mandatory)]
376384
[int64] $Card,
377385

386+
[switch] $Force,
387+
378388
[string] $AccessToken,
379389

380390
[switch] $NoStatus
@@ -387,6 +397,11 @@ function Remove-GitHubProjectCard
387397
$uriFragment = "/projects/columns/cards/$Card"
388398
$description = "Deleting card $Card"
389399

400+
if ($Force -and (-not $Confirm))
401+
{
402+
$ConfirmPreference = 'None'
403+
}
404+
390405
if ($PSCmdlet.ShouldProcess($Card, "Remove card"))
391406
{
392407
$params = @{

Diff for: GitHubProjectColumns.ps1

+15
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ function Remove-GitHubProjectColumn
242242
.PARAMETER Column
243243
ID of the column to remove.
244244
245+
.PARAMETER Force
246+
If this switch is specified, you will not be prompted for confirmation of command execution.
247+
245248
.PARAMETER AccessToken
246249
If provided, this will be used as the AccessToken for authentication with the
247250
REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.
@@ -260,6 +263,11 @@ function Remove-GitHubProjectColumn
260263
.EXAMPLE
261264
Remove-GitHubProjectColumn -Column 999999 -Confirm:$False
262265
266+
Removes the project column with ID 999999 without prompting for confirmation.
267+
268+
.EXAMPLE
269+
Remove-GitHubProjectColumn -Column 999999 -Force
270+
263271
Removes the project column with ID 999999 without prompting for confirmation.
264272
#>
265273
[CmdletBinding(
@@ -271,6 +279,8 @@ function Remove-GitHubProjectColumn
271279
[Parameter(Mandatory)]
272280
[int64] $Column,
273281

282+
[switch] $Force,
283+
274284
[string] $AccessToken,
275285

276286
[switch] $NoStatus
@@ -283,6 +293,11 @@ function Remove-GitHubProjectColumn
283293
$uriFragment = "/projects/columns/$Column"
284294
$description = "Deleting column $Column"
285295

296+
if ($Force -and (-not $Confirm))
297+
{
298+
$ConfirmPreference = 'None'
299+
}
300+
286301
if ($PSCmdlet.ShouldProcess($Column, "Remove column"))
287302
{
288303
$params = @{

Diff for: GitHubProjects.ps1

+15
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,9 @@ function Remove-GitHubProject
450450
.PARAMETER Project
451451
ID of the project to remove.
452452
453+
.PARAMETER Force
454+
If this switch is specified, you will not be prompted for confirmation of command execution.
455+
453456
.PARAMETER AccessToken
454457
If provided, this will be used as the AccessToken for authentication with the
455458
REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.
@@ -470,6 +473,11 @@ function Remove-GitHubProject
470473
471474
Remove project with ID '4387531' without prompting for confirmation.
472475
476+
.EXAMPLE
477+
Remove-GitHubProject -Project 4387531 -Force
478+
479+
Remove project with ID '4387531' without prompting for confirmation.
480+
473481
.EXAMPLE
474482
$project = Get-GitHubProject -OwnerName Microsoft -RepositoryName PowerShellForGitHub | Where-Object Name -eq 'TestProject'
475483
Remove-GitHubProject -Project $project.id
@@ -486,6 +494,8 @@ function Remove-GitHubProject
486494
[Parameter(Mandatory)]
487495
[int64] $Project,
488496

497+
[switch] $Force,
498+
489499
[string] $AccessToken,
490500

491501
[switch] $NoStatus
@@ -498,6 +508,11 @@ function Remove-GitHubProject
498508
$uriFragment = "projects/$Project"
499509
$description = "Deleting project $Project"
500510

511+
if ($Force -and (-not $Confirm))
512+
{
513+
$ConfirmPreference = 'None'
514+
}
515+
501516
if ($PSCmdlet.ShouldProcess($project, "Remove project"))
502517
{
503518
$params = @{

0 commit comments

Comments
 (0)