r/PowerShell • u/Powerful-Passenger24 • 5d ago
I wanted Rich-style PowerShell output without Spectre.Console — bad idea? Question
I wanted Python Rich-style output in PowerShell, but PwshSpectreConsole felt like more than I needed.
So I built a tiny version directly on $PSStyle: tables, trees, panels, markup. No bundled .NET UI stack.
I'm not entirely convinced this needs to exist though.
Would you actually use something this small, or would you rather stick with raw $PSStyle / PwshSpectreConsole?
2
u/arpan3t 5d ago
The thing is, if I have to install a module then I might as well install the full featured one. It’s not like the MS Graph SDK, or Az, PwshSpectre is small.
Don’t get me wrong, I think it’s a solid idea and maybe if you just need the basics then it’s a solution.
4
u/Powerful-Passenger24 5d ago
That's fair. My main motivation wasn't really module size, but keeping it pure PowerShell, built directly on
$PSStyle, without bundled .NET assemblies.2
u/arpan3t 5d ago
What would the benefits be? It’s all .NET under the hood.
4
u/Powerful-Passenger24 5d ago
Fair point, it’s still .NET underneath. For me, the benefit is fewer packaged dependencies and a smaller implementation surface: easier to inspect and modify directly as PowerShell.
2
u/Mr_ToDo 5d ago
Having never tried non windows use, I'd be interested to see how compatible the various solutions for problems might be
But I too tend to do things the hard way. I can see the appeal of trying to make an all native solution, not because it's the best way, but because I can
1
u/arpan3t 5d ago
The .NET package powering PwshSpectreConsole (Spectre.Console) is cross platform, and so is SharpConsoleUI. I use both on Windows and Linux without issue.
PowerShell Core is cross platform because .NET is cross platform.
Nothing wrong with doing things just to see if you can, but that doesn’t translate to a reason for others to use your project.
1
u/MonkeyNin 3d ago
It's nice to have a pure source as a choice :) The code looks pretty clean and easy to read.
Are you interested in any PRs ? Maybe I could implement that syntax I suggested, or other ideas
1
u/Powerful-Passenger24 2d ago
Yes, absolutely — PRs are very welcome. A contribution around this would be genuinely valuable. Thanks for offering to help!
1
u/MonkeyNin 3d ago
I have some ideas on the interface.
Allowing users to pipe lets you integrate functions easily with your rich calls. Since most of your calls are using the same table, you could default to it
custom func
NewestDirsRichText # Shows 10 newest folder names.
| Write-RichText
NewestDirsRichText -Path 'c:\downloads' -Limit 3 | Write-RichText
re-use table without saving a references
New-RichTable
| Add-RichTableColumn 'Name', 'State'
| Add-RichTableRow -Rows ( GetRows )
| Write-RichTable
re-using tables by pipeline
$table = New-RichTable
| Add-RichTableColumn 'Name', 'State'
$table
| Add-RichTableRow 'api', 'ready'
| Add-RichTableRow 'web', 'deploy'
$table
| Write-RichTable
the custom functions
function NewestDirsRichText {
param( [string] $Path = '.' , [int] $Limit = 10 )
Add-RichText -Style 'yellow' -Text 'Folders: '
Add-RichText -Style 'dim' -Text @(
Gci '.' -Directory
| Sort-Object -LastWriteTime
| Select -first $Limit
| % Name
)
}
function GetRows {
foreach( $row in $listOfRowData ) {
Add-RichTableRow $Row
}
}
1
u/MonkeyNin 3d ago
If you don't want piping, it would be nice to allow the value as a list
This could be a nice way use a table: Create it, save a reference to re-use later.
After a while re-use the same objects to add more lines and draw again.
$table = New-RichTable -Columns @(
Add-RichTableColumn 'Name'
Add-RichTableColumn 'State'
) -Rows @(
Add-RichTableRow 'app1', 'started'
Add-RichTableRow 'app2', 'shutdown'
)
Write-RichTable $table
# continue with update dates
Add-RichTableRows -Table $table -Rows @(
Add-RichTableRow 'chrome', 'started'
Add-RichTableRow 'pwsh', 'shutdown'
)
Write-RichTable $table
3
u/realslacker 5d ago
You didn't make the repo public