Format-Hex: Handle all primitive types & better array input handling#8596
Closed
vexx32 wants to merge 4 commits intoPowerShell:masterfrom
Closed
Format-Hex: Handle all primitive types & better array input handling#8596vexx32 wants to merge 4 commits intoPowerShell:masterfrom
vexx32 wants to merge 4 commits intoPowerShell:masterfrom
Conversation
- Enums of primitive types are supported - Heterogenous arrays are handled properly - Homogenous piped input is handled as a single array
⚠️ Tests were failing due to difference in line endings on Unix
Collaborator
Author
|
Test failure looks... Yeah, I'm not sure what that is. Doesn't look like what I've been touching, though? Possibly a race condition or something... weird. Think I've seen it in at least one other PR, though, so I'm pretty sure it's not my doing. 😄 |
SteveL-MSFT
requested changes
Jan 6, 2019
| [OutputType(typeof(Microsoft.PowerShell.Commands.ByteCollection))] | ||
| [Alias("fhx")] | ||
| public sealed class FormatHex : PSCmdlet | ||
| public sealed class FormatHexCommand : PSCmdlet |
Member
There was a problem hiding this comment.
Agree it's inconsistent, but since this class is public, we shouldn't rename it.
Collaborator
Collaborator
Author
Collaborator
|
@vexx32 Perhaps move to new PR would be better. |
Collaborator
Author
|
@iSazonov you may be right. I'll pull down a new branch and see what I can do. 😄 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Summary
Fixes #3358
Adds support to Format-Hex for any primitive type, along with strings and direct file input.
Notes:
FormatHex->FormatHexCommandBehaviour change
Cmdlet now treats a homogenous piped input array as a single item, so that pipeline input behaviour should mirror directly presented
-InputObjectbehaviour. In other words,[byte[]](1, 2, 3) | fhxwill be treated as a single array and displayed in a single line, instead of being treated as completely separate items.When a similar jagged array is presented, however, the cmdlet will notice and output each pipeline item as a separate display. This should have pretty high consistency in terms of handling string input mixed with other things, as well as just handling jagged input with pretty good consistency with how it would handle standalone input.
Enums are supported and will be processed according to their base type (int32 for PowerShell-native enums, all valid base primitives from C#).
Kinda fun to work with, now. 😄
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