GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow 'name' as an alias key for 'label' in ConvertTo-Html, allow the 'width' entry to be an integer by mklement0 · Pull Request #8426 · PowerShell/PowerShell

Conversation

@mklement0

@mklement0 Michael Klement (mklement0) commented Dec 8, 2018

Copy link
Copy Markdown
Contributor

PR Summary

Fixes #6994, and additionally allows key width to be specified not just as a [string] (as before), but alternatively as an [int], analogous to the use of width with Format-Table.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Change is not breaking
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready.
  • User-facing changes
    • Not Applicable
    • OR
    • User-facing Documentation needed
      • Issue filed - Issue link:
  • Testing - New and feature
    • Not Applicable or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed
      • Add [feature] if the change is significant or affects feature tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Michael Klement (mklement0) added 2 commits December 7, 2018 21:02
@mklement0
Fixes PowerShell#6994
f0e5ada
- Allows use of 'name' as an alias for 'label' in calculated properties
- Allows specifying a 'width' value as an integer as well as a string
@mklement0
Reverted accidental change to launch.json
12c24f3
@mklement0
Michael Klement (mklement0) requested review from James Truher (JamesWTruher) and Paul Higinbotham (PaulHigin) as code owners December 8, 2018 02:12
Michael Klement (mklement0) added 2 commits December 7, 2018 21:17
@mklement0
CodeFactor style changes
70a830c
@mklement0
Typo
a9b5a9a
@mklement0 Michael Klement (mklement0) changed the title Allow 'name' as an alias key for 'label' in ConvertTo-Html, allow the 'width' value to be an integer Allow 'name' as an alias key for 'label' in ConvertTo-Html, allow the 'width' entry to be an integer Dec 8, 2018
@mklement0
switched to using LabelEntryDefinion() instance
8e5cb3a
iSazonov
Ilya (iSazonov) reviewed Dec 8, 2018
View reviewed changes
Comment thread src/Microsoft.PowerShell.Commands.Utility/commands/utility/convert-HTML.cs

// Accept the width both as a string and as an int.
string width;
int? widthNum = p.GetEntry(ConvertHTMLParameterDefinitionKeys.WidthEntryKey) as int?;

@iSazonov Ilya (iSazonov) Dec 8, 2018

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Why not:

Suggested change
int? widthNum = p.GetEntry(ConvertHTMLParameterDefinitionKeys.WidthEntryKey) as int?;
var widthEntryKey = p.GetEntry(ConvertHTMLParameterDefinitionKeys.WidthEntryKey);
if (widthEntryKey is int widthNum)
{
width = widthNum.Value.ToString();
}
else
{
width = widthEntryKey as string;
}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
iSazonov
Ilya (iSazonov) reviewed Dec 8, 2018
View reviewed changes
Comment thread test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Html.Tests.ps1
$returnString | Should -Match 'AgeRenamed'
}

It "Test ConvertTo-HTML calculated property supports integer 'width' entry" {

@iSazonov Ilya (iSazonov) Dec 8, 2018

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Only integer?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mklement0 Michael Klement (mklement0) Dec 8, 2018

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ilya (@iSazonov): Good question: int is the type of the Alignment entry for Format-Table, and I simply amended that class to also be able to use it with ConvertTo-Html, with a string-typed width entry.

Since we're talking about UIs and column widths, my guess is that [int] is enough, but I'm not wedded to that, and if someone knows that a wider type is called for, I'm all ears.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iSazonov reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@iSazonov Ilya (iSazonov) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Dec 8, 2018
@iSazonov
Ilya (iSazonov) requested a review from Mark Kraus (markekraus) December 8, 2018 10:36
iSazonov
Ilya (iSazonov) approved these changes Dec 8, 2018
View reviewed changes

@iSazonov Ilya (iSazonov) left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Dec 8, 2018
Consider creating a conceptual help topic for calculated properties MicrosoftDocs/PowerShell-Docs#3383
Closed
[Feature] Define short alias names for all keys supported in calculated-property definitions #8430
Closed
@stale

stale Bot commented Jan 8, 2019

Copy link
Copy Markdown

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stale stale Bot added the Stale label Jan 8, 2019
@mklement0

Michael Klement (mklement0) commented Jan 8, 2019

Copy link
Copy Markdown
Contributor Author

Steve Lee (@SteveL-MSFT), what will it take to get this merged? Another review, or just an act of merging by someone who's authorized?

I fear that the related #8427 and #8430 are about to go stale too.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov
Ilya (iSazonov) requested a review from Steve Lee (SteveL-MSFT) January 8, 2019 10:13
@stale stale Bot removed the Stale label Jan 8, 2019
anmenaga
Andrew (anmenaga) approved these changes Jan 17, 2019
View reviewed changes

@anmenaga Andrew (anmenaga) left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Michael Klement (@mklement0) 'Codacy/PR Quality Review' needs a minor style update; otherwise this looks fine.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@anmenaga Andrew (anmenaga) assigned Aditya Patwardhan (adityapatwardhan) Jan 17, 2019
Michael Klement (mklement0) added 7 commits January 17, 2019 16:17
@mklement0
addresses Codacy/PR Quality Review issue
144bd99
@mklement0
addresses CodeFactor issues
db864f1
@mklement0
resolves merge conflict
3e1b38a
@mklement0
resolves merge conflict
b993fad
@mklement0
???
529fb98
@mklement0
resolves merge conflict
d3a6975
@mklement0
resolves merge conflict
70614e2
@mklement0

Michael Klement (mklement0) commented Jan 17, 2019

Copy link
Copy Markdown
Contributor Author

Thanks, Andrew (@anmenaga).

I've resolved the code-style issues.

Unfortunately, I haven't been able to resolve the merge conflict, and I'm at a loss as to how to do so.
I've copied the changes that have since been added to the master branch to my branch, yet a conflict is still reported (I've later added a small whitespace fix).

Can you help?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Jan 18, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Michael Klement (@mklement0) Please remove/reset last commits (merge resolve) - I'm afraid that you could break something. Then you could use "Resolve conflicts" button in GitHub or ping me for help.

# Reset to commit "ooooooo"
git reset --hard ooooooo  
# Remove last commit
git reset --hard HEAD~1
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vexx32

Rain Sallow (/u/ta11ow) (vexx32) commented Jan 18, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Michael Klement (@mklement0) Did you make a merge commit or just copy the changes across?

If the latter, make sure your master branch is up to date, change to this branch, and then git merge master. Resolve conflicts in your editor and make the final merge commit, then push the changes. That will usually resolve the conflict.

Also note that if you need to reset back from some commits, as Ilya mentions you may want to do, you will need a force-push to remove them from the remote once you're done.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mklement0
resolves merge conflict
10c064c
@mklement0

Michael Klement (mklement0) commented Jan 18, 2019

Copy link
Copy Markdown
Contributor Author

I appreciate your help, Rain Sallow (/u/ta11ow) (@vexx32) and Ilya (@iSazonov).

Indeed I hadn't merged locally and had just tried to copy the changes manually.
(Merging on GitHub wasn't possible.)

I've now merged locally and pushed again, which resolves the conflict.

Do I still need to reset something?
Seems like you could now simply squash-merge.
Ilya (@iSazonov), what could break?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Jan 18, 2019

Copy link
Copy Markdown
Collaborator

After resolving merge conflicts we have to review again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Jan 18, 2019

Copy link
Copy Markdown
Collaborator

Aditya Patwardhan (@adityapatwardhan) The PR is ready to merge.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mklement0

Michael Klement (mklement0) commented Jan 18, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Thanks, Ilya (@iSazonov).

Just so I get it right in the future, the procedure should be:

  • Use GitHub's own merging feature if available (it wasn't in this case).

  • Otherwise, merge locally first from an up-to-date master branch, then push, as per Rain Sallow (/u/ta11ow) (@vexx32)'s instructions.

Correct?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Jan 18, 2019

Copy link
Copy Markdown
Collaborator

Michael Klement (@mklement0) Currently GitHub "resolve merge conflicts" feature works very well and can be used for fast resolving simple conflicts. Large and complex conflicts we have to do locally. I guess there is many ways to do this in git. You can use a way you prefer. Usually I use git pull --rebase PowerShell master then follow git hints.

mklement0 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@adityapatwardhan

Aditya Patwardhan (adityapatwardhan) commented Jan 18, 2019

Copy link
Copy Markdown
Member

Michael Klement (@mklement0) Could you answer Ilya (@iSazonov) suggestion?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mklement0

Michael Klement (mklement0) commented Jan 18, 2019

Copy link
Copy Markdown
Contributor Author

Aditya Patwardhan (@adityapatwardhan):

Ilya (@iSazonov) was responding how to handle this situation in the future - duly noted by me (and acknowledged with a thumbs-up).

Is there something left to resolve for this PR?
My (superficial) understanding is that the way I've eventually resolved the merge conflict should now allow for squash-merging.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@adityapatwardhan
Aditya Patwardhan (adityapatwardhan) merged commit 20919ee into PowerShell:master Jan 18, 2019
@adityapatwardhan

Aditya Patwardhan (adityapatwardhan) commented Jan 18, 2019

Copy link
Copy Markdown
Member

Michael Klement (@mklement0) Thanks for your contribution!

iSazonov reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@mklement0 @adityapatwardhan
Allow 'name' as an alias key for 'label' in ConvertTo-Html, allow the…
4804083
… 'width' entry to be an integer (PowerShell#8426)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iSazonov Ilya (iSazonov) iSazonov approved these changes
@JamesWTruher James Truher (JamesWTruher) Awaiting requested review from JamesWTruher
@PaulHigin Paul Higinbotham (PaulHigin) Awaiting requested review from PaulHigin
@markekraus Mark Kraus (markekraus) Awaiting requested review from markekraus
@SteveL-MSFT Steve Lee (SteveL-MSFT) Awaiting requested review from SteveL-MSFT
+1 more reviewer
@anmenaga Andrew (anmenaga) anmenaga approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@adityapatwardhan Aditya Patwardhan (adityapatwardhan)

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Calculated properties passed to ConvertTo-Html do not support the "n" / "name" key

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@mklement0 @iSazonov @vexx32 @adityapatwardhan @anmenaga
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.