-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Format-Hex: Handle all primitive types & better array input handling #8596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
|
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. 😄 |
| [OutputType(typeof(Microsoft.PowerShell.Commands.ByteCollection))] | ||
| [Alias("fhx")] | ||
| public sealed class FormatHex : PSCmdlet | ||
| public sealed class FormatHexCommand : PSCmdlet |
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.
Agree it's inconsistent, but since this class is public, we shouldn't rename it.
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.
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.
|
@vexx32 Perhaps move to new PR would be better. |
|
@iSazonov you may be right. I'll pull down a new branch and see what I can do. 😄 |
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