Add ConvertTo-CliXml and ConvertFrom-CliXml cmdlets - #21011
Add ConvertTo-CliXml and ConvertFrom-CliXml cmdlets#21011Armaan Mcleod (ArmaanMcleod) wants to merge 4 commits into
ConvertTo-CliXml and ConvertFrom-CliXml cmdlets#21011Conversation
|
Did you address #12845 (comment)? |
I'm not sure if I agree with that comment. The existing It can probably be done for Also reasoning for using |
There are security "wrappers" specific to PowerShell. We should follow that. |
I think for using security wrapper PSSerializer it is possible, but it requires creating more overloads for cmdlet |
|
Ilya (@iSazonov) Travis Plunk (@TravisEz13) I have converted code to use If introducing these overloads is not acceptable, I can go back to previous approach with internal API. I can also not make the access modifiers not |
10e6ea8 to
9428101
Compare
Reverted this as we don't see a need for |
|
Thanks Michael Klement (@mklement0) and Ilya (@iSazonov) for comprehensive and very helpful reviews 🙂. I have included an Please review if you get a chance and let me know if I've missed anything. |
Ilya (iSazonov)
left a comment
There was a problem hiding this comment.
Armaan Mcleod (@ArmaanMcleod) Please replace tabs in tests if you see them.
And if you don't plan new commits I suggest squash commits (to many commits, too many comments) and open new PR.
d9068e2 to
28fbf0b
Compare
471dda7 to
10708e4
Compare
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
Thanks Ilya (@iSazonov) I have opened up a new PR #21063. Closing this one in favour of that one. |
PR Summary
Fixes #3898
Add
ConvertTo-CliXmlandConvertFrom-CliXmlcmdlets to work with CliXml objects in memory without needing to read/write to file system.PR Context
Parameter sets
Usage
Alot of this was inspired from #12845, but that PR is quite old and never got merged. I just created a new PR and made some changes since it was easier.
Also included
internal static string Serialize(IList<object> source, int depth, bool enumerate)inPSSerializerAPI. This was to be able to enumerate and serialize objects one at a time instead of writing one top level object.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.ConvertTo-CliXmlandConvertFrom-CliXmlcmdlets MicrosoftDocs/PowerShell-Docs#10773(which runs in a different PS Host).