NativeHTMLKit.Demo.psm1
|
# NativeHTMLKit.Demo - browse and run the NativeHTMLKit examples from one window. function Start-NativeHTMLKitDemo { <# .SYNOPSIS Opens the NativeHTMLKit Demo: every NativeHTMLKit example with its source and a Run button. .DESCRIPTION The demo window lists the examples of the NativeHTMLKit PowerShell and Python SDKs and of NativeHTMLKit UI. For each example it shows the PowerShell, Python, HTML and CSS source, and Run PowerShell / Run Python start that version in a separate process. Python examples need Python 3.10+ with the nativehtmlkit-demo package (python -m pip install nativehtmlkit-demo). The demo runs in a new PowerShell process (the same edition as the current one); the command returns when the demo window is closed. .PARAMETER SelfTest Run the headless self-test instead of opening the window, print PASS/FAIL lines and set $LASTEXITCODE (0 when everything passed). .EXAMPLE Start-NativeHTMLKitDemo #> [CmdletBinding()] param([switch]$SelfTest) $exe = (Get-Process -Id $PID).Path $arguments = @('-NoLogo', '-NoProfile') if ([Environment]::OSVersion.Platform -eq [PlatformID]::Win32NT) { $arguments += @('-ExecutionPolicy', 'Bypass') } $arguments += @('-File', (Join-Path $PSScriptRoot 'Demo.ps1')) if ($SelfTest) { $arguments += '-SelfTest' } & $exe @arguments } Export-ModuleMember -Function Start-NativeHTMLKitDemo |