Skip to content

Conversation

@powercode
Copy link
Collaborator

@powercode powercode commented Feb 21, 2018

PR Summary

Adding Item selection conditions to the list formatting info for MeasureInfo so that only the properties with values gets displayed

PR Checklist

Note: Please mark anything not applicable to this PR NA.


$text = 1, 2, 3 | Measure-Object -Minimum -Maximum | format-list | out-string
$text -match "min|max" | should -BeTrue
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a correct letter case in all lines.

}

/// <summary>
/// Creates a DisplayEntry for the given scriptblock
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add final dot in public comments.

/// Creates a DisplayEntry for the given scriptblock
/// </summary>
/// <param name="scriptblock">The content of the scriptblock</param>
public static DisplayEntry CreateScriptBlockEntry(string scriptblock)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where we use the method?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't.
But CreatePropertyEntry is used now, so I added the scriptblock one for completeness.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear.
We should add tests for the public method.


/// <summary></summary>
public ListEntryBuilder AddItemScriptBlock(string scriptBlock, string label = null, string format = null)
public ListEntryBuilder AddItemScriptBlock(string scriptBlock, string label = null, string format = null, DisplayEntry itemSelectionContition = null )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the change binary backward compatible? We shouldn't break public API.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is not binary compatible.

That said, it is unlikely anyone uses this api yet, people still rely on a ps1xml file because there isn't a good way for a module author to use this api in a useful way yet.


/// <summary></summary>
public ListEntryBuilder AddItemProperty(string property, string label = null, string format = null)
public ListEntryBuilder AddItemProperty(string property, string label = null, string format = null, DisplayEntry itemSelectionContition = null)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same.

.AddItemProperty(@"Maximum")
.AddItemProperty(@"Minimum")
.AddItemProperty(@"Property")
.AddItemProperty(@"Average", itemSelectionContition: DisplayEntry.CreatePropertyEntry("Average"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add AddItemPropertyByCondition.

@iSazonov
Copy link
Collaborator

@SteveL-MSFT The PR contains a public API change - PowerShell Committee conclusion needed.

@SteveL-MSFT SteveL-MSFT added the Review - Committee The PR/Issue needs a review from the PowerShell Committee label Feb 22, 2018
It 'should only display fields that are set' {
$text = 1, 2, 3 | Measure-Object -sum -Average | format-list | out-string
$text -match "min|max" | should -BeFalse
$text = 1, 2, 3 | Measure-Object -sum -Average | Format-List | Out-String
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace sum with Sum.

@iSazonov
Copy link
Collaborator

@powercode Thanks! We are waiting PowerShell Committee.


It 'should only display fields that are set' {
$text = 1, 2, 3 | Measure-Object -Sum -Average | Format-List | Out-String
$text -match "min|max" | Should -BeFalse
Copy link
Collaborator

@JamesWTruher JamesWTruher Feb 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better if this was a positive test? What should this actually look like? or both positive/negative?

@SteveL-MSFT
Copy link
Member

@PowerShell/powershell-committee reviewed this and is ok with the public apis

@iSazonov iSazonov added Committee-Reviewed PS-Committee has reviewed this and made a decision and removed Review - Committee The PR/Issue needs a review from the PowerShell Committee labels Mar 1, 2018
@stale
Copy link

stale bot commented Apr 20, 2018

This PR has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 10 days.
Thank you for your contributions.
Community members are welcome to grab these works.

@stale stale bot added the Stale label Apr 20, 2018
@stale
Copy link

stale bot commented Apr 30, 2018

This PR has be automatically close because it is stale. If you wish to continue working on the PR, please first update the PR, then reopen it.
Thanks again for your contribution.
Community members are welcome to grab these works.

@stale stale bot closed this Apr 30, 2018
@powercode powercode changed the title MeasureInfo: Only display properties with values WIP MeasureInfo: Only display properties with values Jun 18, 2018
@powercode
Copy link
Collaborator Author

Updating

@powercode powercode changed the title WIP MeasureInfo: Only display properties with values MeasureInfo: Only display properties with values Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Committee-Reviewed PS-Committee has reviewed this and made a decision Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants