Skip to content

Commit

Permalink
Unify Label parameter names to singular form in New-/Set-JiraIssue (
Browse files Browse the repository at this point in the history
#522)

* Add `-Labels` --> `-Label` alias to `Set-JiraIssue`

* Rename+alias `-Labels` to `-Label` in `New-JiraIssue`

* Update docs

* Update unit tests

---------

Co-authored-by: hmmwhatsthisdo <[email protected]>
  • Loading branch information
hmmwhatsthisdo and hmmwhatsthisdo authored Sep 25, 2024
1 parent 3563707 commit 19476cc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions JiraPS/Public/New-JiraIssue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ function New-JiraIssue {
$Reporter,

[Parameter( ValueFromPipelineByPropertyName )]
[Alias("Labels")]
[String[]]
$Labels,
$Label,

[Parameter( ValueFromPipelineByPropertyName )]
[String]
Expand Down Expand Up @@ -105,9 +106,9 @@ function New-JiraIssue {
$requestBody["parent"] = @{"key" = $Parent}
}

if ($Labels) {
if ($Label) {
$requestBody["labels"] = [System.Collections.ArrayList]@()
foreach ($item in $Labels) {
foreach ($item in $Label) {
$null = $requestBody["labels"].Add($item)
}
}
Expand Down
1 change: 1 addition & 0 deletions JiraPS/Public/Set-JiraIssue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function Set-JiraIssue {
[Object]
$Assignee,

[Alias("Labels")]
[String[]]
$Label,

Expand Down
2 changes: 1 addition & 1 deletion Tests/Functions/New-JiraIssue.Unit.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Describe "New-JiraIssue" -Tag 'Unit' {
defParam $command 'Summary'
defParam $command 'Description'
defParam $command 'Reporter'
defParam $command 'Labels'
defParam $command 'Label'
defParam $command 'Fields'
defParam $command 'Credential'
}
Expand Down
4 changes: 2 additions & 2 deletions docs/en-US/commands/New-JiraIssue.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Creates a new issue in JIRA

```powershell
New-JiraIssue [-Project] <String> [-IssueType] <String> [-Summary] <String> [[-Priority] <Int32>]
[[-Description] <String>] [[-Reporter] <String>] [[-Labels] <String[]>] [[-Components] <String[]>] [[-Parent] <String>]
[[-Description] <String>] [[-Reporter] <String>] [[-Label] <String[]>] [[-Components] <String[]>] [[-Parent] <String>]
[[-FixVersion] <String[]>] [[-Fields] <PSCustomObject>] [[-Credential] <PSCredential>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```
Expand Down Expand Up @@ -192,7 +192,7 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -Labels
### -Label
List of labels which will be added to the issue.
Expand Down

0 comments on commit 19476cc

Please sign in to comment.