People keep saying how amazing ChatGPT is, so I thought I'd try it on a C# to PowerShell conversion.
What the heck even is this?
People keep saying how amazing ChatGPT is, so I thought I'd try it on a C# to PowerShell conversion.
What the heck even is this?
@jamie @otterkring in the end, I gave it a lot more context, and got a much better result, but...
It still used the PS1 syntax with the inline parameters and New-Object
It refuses to use the $sb.Append overloads the original code uses, doing string concatenation instead...
It didn't use `[void]` with $sb.Append (the way it DID in the screenshot), so it output the StringBuilder repeatedly. When I asked it to fix that, it mangled the code...
@jamie @otterkring for what it's worth, I did convert it into something that worked for me.
So I now have a function you can use in #PowerShell to syntax highlight arbitrary code roughly the way #PSReadLine does it:
https://github.com/Jaykul/EzTheme/commit/58c5883514f787e42e0cd4aaef864c299542cc2d