AtlassianPS / JiraPS

PowerShell module to interact with Atlassian JIRA
https://AtlassianPS.org/module/JiraPS
MIT License
325 stars 131 forks source link

Format-Jira broken when not using pipeline #437

Closed fsackur closed 3 years ago

fsackur commented 3 years ago

Description

When explicilty specifying InputObject and rpoviding more than one object, Format-Jira cross-multiplies properties.

Steps To Reproduce

Works:

$Chrome = (Get-Process chrome | Select-Object -First 3)
$Chrome | Format-Jira

||Id||Handles||CPU||SI||Name||
|1124|231|1.328125|1|chrome|
|1600|312|1.421875|1|chrome|
|2152|393|5.359375|1|chrome|

Doesn't work:

Format-Jira -InputObject $Chrome

||Id||Handles||CPU||SI||Name||
|1124 1600 2152|231 312 393|1.328125 1.421875 5.375|1 1 1|chrome chrome chrome|
|1124 1600 2152|231 312 393|1.328125 1.421875 5.375|1 1 1|chrome chrome chrome|
|1124 1600 2152|231 312 393|1.328125 1.421875 5.375|1 1 1|chrome chrome chrome|

Expected behavior

Screenshots

Your Environment

Possible Solution

The bug is here:

https://github.com/AtlassianPS/JiraPS/blob/298dce5/JiraPS/Public/Format-Jira.ps1#L97

That needs to be:

$value = $i.$h

Alternatively, don't accept collections in InputObject. It breaks standard practice - all of the built-in cmdlets declare [object]$InputObject.