ShaunLawrie / PwshSpectreConsole

👻 PwshSpectreConsole is a PowerShell wrapper for the awesome Spectre.Console library
https://pwshspectreconsole.com/
MIT License
117 stars 7 forks source link

Updates to Format-SpectreTable and Format-SpectreJson #27

Closed trackd closed 9 months ago

trackd commented 9 months ago

Format-SpectreJson if it detects a '.json' file (e.g Get-Childitem -File *.json | fsj) it will render it. it tries to detect streams of json as well, e.g (Get-Childitem -File *.json | gc | fsj) or something like: (iwr https://httpbin.org/get).Content | fsj fsj

i had to disable some tests, i'll try and get some new tests to replace them.

trackd commented 9 months ago

i havnt fully tested the Format-Table parameters i've added, they work but i think Spectre.Console overrides a few of them (like -Wrap and -AutoSize)

trackd commented 9 months ago

@ShaunLawrie i think this might be ready.

Do we need more tests?

Edit: just realized i havnt tested all the Format-Table params i passthru.

Like -wrap -autosize etc. Im pretty sure spectre ignores that and uses its own settings.

Might be better to just remove them and keep the ones that actually effect output.

Or change the way they work to map to spectre settings.

Ill take a look at it tomorrow.

ShaunLawrie commented 9 months ago

lgtm, ready to merge when you're happy. Nice tweak adding the image from remote source.

trackd commented 9 months ago

Removed -Expand and -AutoSize, kept -Wrap it technically doesn't do anything at the moment but there is an open issue in spectre.console. it doesn't really matter that it's there but when its fixed in Spectre it should automatically work for us.

cleaned up a bit and did some tweaks with better error handling etc.

it's ready to merge to prerelease

ShaunLawrie commented 9 months ago

Nice!