Skip to content

Adding -Force switch to ConfirmImpact=High functions #226

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

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions GitHubAssignees.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ function Remove-GithubAssignee
the background, enabling the command prompt to provide status information.
If not supplied here, the DefaultNoStatus configuration property value will be used.

.PARAMETER Force
If this switch is specified, you will not be prompted for confirmation of command execution.

.EXAMPLE
Remove-GithubAssignee -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Assignee $assignees

Expand All @@ -333,6 +336,11 @@ function Remove-GithubAssignee
Remove-GithubAssignee -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Assignee $assignees -Confirm:$false

Lists the available assignees for issues from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.

.EXAMPLE
Remove-GithubAssignee -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Assignee $assignees -Force

Lists the available assignees for issues from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Force was specified.
#>
[CmdletBinding(
SupportsShouldProcess,
Expand All @@ -359,7 +367,9 @@ function Remove-GithubAssignee

[string] $AccessToken,

[switch] $NoStatus
[switch] $NoStatus,

[switch] $Force
)

Write-InvocationLog
Expand All @@ -379,7 +389,7 @@ function Remove-GithubAssignee
'assignees' = $Assignee
}

if ($PSCmdlet.ShouldProcess($Assignee -join ', ', "Remove assignee(s)"))
if ($Force -or $PSCmdlet.ShouldProcess($Assignee -join ', ', "Remove assignee(s)"))
{
$params = @{
'UriFragment' = "repos/$OwnerName/$RepositoryName/issues/$Issue/assignees"
Expand Down
14 changes: 12 additions & 2 deletions GitHubComments.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ function Remove-GitHubComment
the background, enabling the command prompt to provide status information.
If not supplied here, the DefaultNoStatus configuration property value will be used.

.PARAMETER Force
If this switch is specified, you will not be prompted for confirmation of command execution.

.EXAMPLE
Remove-GitHubComment -OwnerName Microsoft -RepositoryName PowerShellForGitHub -CommentID 1

Expand All @@ -456,6 +459,11 @@ function Remove-GitHubComment
.EXAMPLE
Remove-GitHubComment -OwnerName Microsoft -RepositoryName PowerShellForGitHub -CommentID 1 -Confirm:$false

Deletes a Github comment from the Microsoft\PowerShellForGitHub project without prompting confirmation.

.EXAMPLE
Remove-GitHubComment -OwnerName Microsoft -RepositoryName PowerShellForGitHub -CommentID 1 -Force

Deletes a Github comment from the Microsoft\PowerShellForGitHub project without prompting confirmation.
#>
[CmdletBinding(
Expand All @@ -481,7 +489,9 @@ function Remove-GitHubComment

[string] $AccessToken,

[switch] $NoStatus
[switch] $NoStatus,

[switch] $Force
)

Write-InvocationLog
Expand All @@ -496,7 +506,7 @@ function Remove-GitHubComment
'CommentID' = (Get-PiiSafeString -PlainText $CommentID)
}

if ($PSCmdlet.ShouldProcess($CommentID, "Remove comment"))
if ($Force -or $PSCmdlet.ShouldProcess($CommentID, "Remove comment"))
{
$params = @{
'UriFragment' = "repos/$OwnerName/$RepositoryName/issues/comments/$CommentID"
Expand Down
28 changes: 24 additions & 4 deletions GitHubLabels.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ function Remove-GitHubLabel
the background, enabling the command prompt to provide status information.
If not supplied here, the DefaultNoStatus configuration property value will be used.

.PARAMETER Force
If this switch is specified, you will not be prompted for confirmation of command execution.

.EXAMPLE
Remove-GitHubLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel

Expand All @@ -321,6 +324,11 @@ function Remove-GitHubLabel
Remove-GitHubLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Confirm:$false

Removes the label called "TestLabel" from the PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.

.EXAMPLE
Remove-GitHubLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Force

Removes the label called "TestLabel" from the PowerShellForGitHub project. Will not prompt for confirmation, as -Force was specified.
#>
[CmdletBinding(
SupportsShouldProcess,
Expand All @@ -347,7 +355,9 @@ function Remove-GitHubLabel

[string] $AccessToken,

[switch] $NoStatus
[switch] $NoStatus,

[switch] $Force
)

Write-InvocationLog
Expand All @@ -361,7 +371,7 @@ function Remove-GitHubLabel
'RepositoryName' = (Get-PiiSafeString -PlainText $RepositoryName)
}

if ($PSCmdlet.ShouldProcess($Name, "Remove label"))
if ($Force -or $PSCmdlet.ShouldProcess($Name, "Remove label"))
{
$params = @{
'UriFragment' = "repos/$OwnerName/$RepositoryName/labels/$Name"
Expand Down Expand Up @@ -869,6 +879,9 @@ function Remove-GitHubIssueLabel
the background, enabling the command prompt to provide status information.
If not supplied here, the DefaultNoStatus configuration property value will be used.

.PARAMETER Force
If this switch is specified, you will not be prompted for confirmation of command execution.

.EXAMPLE
Remove-GitHubIssueLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Issue 1

Expand All @@ -878,6 +891,11 @@ function Remove-GitHubIssueLabel
Remove-GitHubIssueLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Issue 1 -Confirm:$false

Removes the label called "TestLabel" from issue 1 in the PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.

.EXAMPLE
Remove-GitHubIssueLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Issue 1 -Force

Removes the label called "TestLabel" from issue 1 in the PowerShellForGitHub project. Will not prompt for confirmation, as -Force was specified.
#>
[CmdletBinding(
SupportsShouldProcess,
Expand All @@ -903,7 +921,9 @@ function Remove-GitHubIssueLabel

[string] $AccessToken,

[switch] $NoStatus
[switch] $NoStatus,

[switch] $Force
)

Write-InvocationLog
Expand All @@ -928,7 +948,7 @@ function Remove-GitHubIssueLabel
$description = "Deleting all labels from issue $Issue in $RepositoryName"
}

if ($PSCmdlet.ShouldProcess($Name, "Remove label"))
if ($Force -or $PSCmdlet.ShouldProcess($Name, "Remove label"))
{
$params = @{
'UriFragment' = "/repos/$OwnerName/$RepositoryName/issues/$Issue/labels/$Name"
Expand Down
14 changes: 12 additions & 2 deletions GitHubMilestones.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,9 @@ function Remove-GitHubMilestone
the background, enabling the command prompt to provide status information.
If not supplied here, the DefaultNoStatus configuration property value will be used.

.PARAMETER Force
If this switch is specified, you will not be prompted for confirmation of command execution.

.EXAMPLE
Remove-GitHubMilestone -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Milestone 1

Expand All @@ -505,6 +508,11 @@ function Remove-GitHubMilestone
Remove-GitHubMilestone -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Milestone 1 -Confirm:$false

Deletes a Github milestone from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.

.EXAMPLE
Remove-GitHubMilestone -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Milestone 1 -Force

Deletes a Github milestone from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Force was specified.
#>
[CmdletBinding(
SupportsShouldProcess,
Expand All @@ -528,7 +536,9 @@ function Remove-GitHubMilestone

[string] $AccessToken,

[switch] $NoStatus
[switch] $NoStatus,

[switch] $Force
)

Write-InvocationLog
Expand All @@ -543,7 +553,7 @@ function Remove-GitHubMilestone
'Milestone' = (Get-PiiSafeString -PlainText $Milestone)
}

if ($PSCmdlet.ShouldProcess($Milestone, "Remove milestone"))
if ($Force -or $PSCmdlet.ShouldProcess($Milestone, "Remove milestone"))
{
$params = @{
'UriFragment' = "repos/$OwnerName/$RepositoryName/milestones/$Milestone"
Expand Down
14 changes: 12 additions & 2 deletions GitHubProjectCards.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ function Remove-GitHubProjectCard
the background, enabling the command prompt to provide status information.
If not supplied here, the DefaultNoStatus configuration property value will be used.

.PARAMETER Force
If this switch is specified, you will not be prompted for confirmation of command execution.

.EXAMPLE
Remove-GitHubProjectCard -Card 999999

Expand All @@ -364,6 +367,11 @@ function Remove-GitHubProjectCard
.EXAMPLE
Remove-GitHubProjectCard -Card 999999 -Confirm:$False

Remove project card with ID 999999 without prompting for confirmation.

.EXAMPLE
Remove-GitHubProjectCard -Card 999999 -Force

Remove project card with ID 999999 without prompting for confirmation.
#>
[CmdletBinding(
Expand All @@ -377,7 +385,9 @@ function Remove-GitHubProjectCard

[string] $AccessToken,

[switch] $NoStatus
[switch] $NoStatus,

[switch] $Force
)

Write-InvocationLog
Expand All @@ -387,7 +397,7 @@ function Remove-GitHubProjectCard
$uriFragment = "/projects/columns/cards/$Card"
$description = "Deleting card $Card"

if ($PSCmdlet.ShouldProcess($Card, "Remove card"))
if ($Force -or $PSCmdlet.ShouldProcess($Card, "Remove card"))
{
$params = @{
'UriFragment' = $uriFragment
Expand Down
14 changes: 12 additions & 2 deletions GitHubProjectColumns.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ function Remove-GitHubProjectColumn
the background, enabling the command prompt to provide status information.
If not supplied here, the DefaultNoStatus configuration property value will be used.

.PARAMETER Force
If this switch is specified, you will not be prompted for confirmation of command execution.

.EXAMPLE
Remove-GitHubProjectColumn -Column 999999

Expand All @@ -260,6 +263,11 @@ function Remove-GitHubProjectColumn
.EXAMPLE
Remove-GitHubProjectColumn -Column 999999 -Confirm:$False

Removes the project column with ID 999999 without prompting for confirmation.

.EXAMPLE
Remove-GitHubProjectColumn -Column 999999 -Force

Removes the project column with ID 999999 without prompting for confirmation.
#>
[CmdletBinding(
Expand All @@ -273,7 +281,9 @@ function Remove-GitHubProjectColumn

[string] $AccessToken,

[switch] $NoStatus
[switch] $NoStatus,

[switch] $Force
)

Write-InvocationLog
Expand All @@ -283,7 +293,7 @@ function Remove-GitHubProjectColumn
$uriFragment = "/projects/columns/$Column"
$description = "Deleting column $Column"

if ($PSCmdlet.ShouldProcess($Column, "Remove column"))
if ($Force -or $PSCmdlet.ShouldProcess($Column, "Remove column"))
{
$params = @{
'UriFragment' = $uriFragment
Expand Down
14 changes: 12 additions & 2 deletions GitHubProjects.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,9 @@ function Remove-GitHubProject
the background, enabling the command prompt to provide status information.
If not supplied here, the DefaultNoStatus configuration property value will be used.

.PARAMETER Force
If this switch is specified, you will not be prompted for confirmation of command execution.

.EXAMPLE
Remove-GitHubProject -Project 4387531

Expand All @@ -470,6 +473,11 @@ function Remove-GitHubProject

Remove project with ID '4387531' without prompting for confirmation.

.EXAMPLE
Remove-GitHubProject -Project 4387531 -Force

Remove project with ID '4387531' without prompting for confirmation.

.EXAMPLE
$project = Get-GitHubProject -OwnerName Microsoft -RepositoryName PowerShellForGitHub | Where-Object Name -eq 'TestProject'
Remove-GitHubProject -Project $project.id
Expand All @@ -488,7 +496,9 @@ function Remove-GitHubProject

[string] $AccessToken,

[switch] $NoStatus
[switch] $NoStatus,

[switch] $Force
)

Write-InvocationLog
Expand All @@ -498,7 +508,7 @@ function Remove-GitHubProject
$uriFragment = "projects/$Project"
$description = "Deleting project $Project"

if ($PSCmdlet.ShouldProcess($project, "Remove project"))
if ($Force -or $PSCmdlet.ShouldProcess($project, "Remove project"))
{
$params = @{
'UriFragment' = $uriFragment
Expand Down
Loading