Skip to content

About

Lightweight PowerShell module for rich console output using PSStyle.

Topics

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

PwshRichLite

PwshRichLite is a lightweight PowerShell module inspired by Python Rich. It renders simple rich console output using PowerShell-native $PSStyle.

Requirements

PowerShell 7.4 or newer (pwsh).

Windows PowerShell 5.1 is not supported.

Install

pwsh
Install-PSResource -Name PwshRichLite
Import-Module PwshRichLite

Examples

Tree

Write-RichTree @{
    Name = '[bold cyan]workspace[/]'
    Children = @(
        @{
            Name = '[bold]PwshRichLite[/]'
            Children = @(
                @{
                    Name = '[blue]Public[/]'
                    Children = @(
                        @{ Name = 'Write-RichTable.ps1' }
                        @{ Name = 'Write-RichTree.ps1' }
                        @{ Name = 'Write-RichPanel.ps1' }
                    )
                }
                @{
                    Name = '[magenta]Private[/]'
                    Children = @(
                        @{ Name = 'ConvertFrom-RichMarkup.ps1' }
                        @{ Name = 'Get-DisplayWidth.ps1' }
                    )
                }
            )
        }
        @{
            Name = '[yellow]tests[/]'
            Children = @(
                @{ Name = 'PwshRichLite.Tests.ps1' }
                @{ Name = 'PwshRichLite.Integration.Tests.ps1' }
            )
        }
    )
}

Tree rendering example

Table

@(
    [pscustomobject]@{
        Component = '[bold]Tree[/]'
        Status = '[green]improved[/]'
        Detail = 'Unicode guides with ASCII fallback'
    }
    [pscustomobject]@{
        Component = '[bold]Table[/]'
        Status = '[green]improved[/]'
        Detail = 'Rich-style borders and title support'
    }
    [pscustomobject]@{
        Component = '[bold]Markup[/]'
        Status = '[cyan]stable[/]'
        Detail = 'Column widths ignore ANSI sequences'
    }
    [pscustomobject]@{
        Component = '[bold]Links[/]'
        Status = '[green]new[/]'
        Detail = '[link=https://github.com/]Open repository[/]'
    }
) | Write-RichTable -Property Component, Status, Detail -Title 'Rendering capabilities'

Table rendering example

Usage

Write-RichText '[bold cyan]PwshRichLite[/] [dim]uses $PSStyle[/]'

Write-RichPanel '[green]Build passed[/]' -Title 'Status'

@(
    [pscustomobject]@{ Name = 'api'; State = 'ready' }
    [pscustomobject]@{ Name = 'web'; State = 'ready' }
) | Write-RichTable -Property Name, State -Title 'Services'

Write-RichRule 'Deploy'

Write-RichTree @{
    Name = '[bold]root[/]'
    Children = @(
        @{ Name = 'src'; Children = @() }
        @{ Name = 'tests'; Children = @() }
    )
}

Rich-like object API:

$text = New-RichText 'Hello' -Style 'bold'
Add-RichText $text ', ' -Style 'dim'
Add-RichText $text 'World' -Style 'cyan'
Write-RichText $text

$table = New-RichTable
Add-RichTableColumn $table 'Name'
Add-RichTableColumn $table 'State'
Add-RichTableRow $table 'api', 'ready'
Add-RichTableRow $table 'web', 'deploy'
Write-RichTable $table

$tree = New-RichTree '[bold]root[/]'
$src = Add-RichTreeNode $tree 'src' -PassThru
Add-RichTreeNode $src 'app.ps1'
Write-RichTree $tree

$panel = New-RichPanel $text -Title 'Greeting'
Write-RichPanel $panel

$rule = New-RichRule 'Build'
Write-RichRule $rule

Tables use Rich-style Unicode borders by default. Use -Box Ascii when you need plain ASCII output. Trees use Unicode guide lines by default; use -Ascii for legacy terminals.

Screenshot-friendly demo:

pwsh ./examples/Show-RichDemo.ps1

Use -NoColor to force plain text for one call:

Write-RichText '[red]plain[/]' -NoColor

The module respects $PSStyle.OutputRendering and NO_COLOR without changing global rendering preferences.

Development

Install local Git hooks:

./scripts/Install-GitHooks.ps1

The pre-commit hook scans staged changes with Gitleaks. It uses a local gitleaks binary when available and falls back to Docker.

Check the runtime:

pwsh --version

Run tests:

pwsh ./scripts/Test-Module.ps1

Build the publishable module folder:

pwsh ./scripts/Build-Module.ps1

Scope

PwshRichLite v0.1.0 intentionally supports a small markup vocabulary:

bold, dim, italic, underline, black, red, green, yellow, blue, magenta, cyan, white.

These map directly to $PSStyle values.

About

Lightweight PowerShell module for rich console output using PSStyle.

Topics

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages