Allow 'name' as an alias key for 'label' in ConvertTo-Html, allow the 'width' entry to be an integer - #8426
Conversation
- 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
|
|
||
| // Accept the width both as a string and as an int. | ||
| string width; | ||
| int? widthNum = p.GetEntry(ConvertHTMLParameterDefinitionKeys.WidthEntryKey) as int?; |
There was a problem hiding this comment.
Why not:
| 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; | |
| } |
| $returnString | Should -Match 'AgeRenamed' | ||
| } | ||
|
|
||
| It "Test ConvertTo-HTML calculated property supports integer 'width' entry" { |
There was a problem hiding this comment.
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.
|
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. |
|
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. |
Andrew (anmenaga)
left a comment
There was a problem hiding this comment.
Michael Klement (@mklement0) 'Codacy/PR Quality Review' needs a minor style update; otherwise this looks fine.
|
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. Can you help? |
|
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. |
|
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 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. |
|
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. I've now merged locally and pushed again, which resolves the conflict. Do I still need to reset something? |
|
After resolving merge conflicts we have to review again. |
|
Aditya Patwardhan (@adityapatwardhan) The PR is ready to merge. |
|
Thanks, Ilya (@iSazonov). Just so I get it right in the future, the procedure should be:
Correct? |
|
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 |
|
Michael Klement (@mklement0) Could you answer Ilya (@iSazonov) suggestion? |
|
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? |
|
Michael Klement (@mklement0) Thanks for your contribution! |
… 'width' entry to be an integer (PowerShell#8426)
PR Summary
Fixes #6994, and additionally allows key
widthto be specified not just as a[string](as before), but alternatively as an[int], analogous to the use ofwidthwithFormat-Table.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests