PowerShell Host Methods using Spectre.Console
MIT License
Enable a PowerShell host implementation that uses Spectre.Console for host methods like progress updates and choice selection.
This is a Proof of Concept module to see what is needed to utilise Spectre.Console
in PowerShell.
See about_PSGhost for more details.
These cmdlets have the following requirements
Here are a few examples where PSGhost changes the implementation for certain host functions. The scripts used to test these scenarios can be found in Examples.
A progress record with a percentage on builtin looks like
Note: The stray line at the top is an artifact of asciinema
This is PSGhost
Note: The bar and spinner are incorrectly generated in asciinema.
A progress record may also not have an explicit percentage indicator but rather embed it in the status description. This is what this looks like on builtin
Note: The stray line at the top is an artifact of asciinema
This is PSGhost
Note: The bar and spinner are incorrectly generated in asciinema.
Here is what $host.UI.PromptForChoice
looks like today
This is PSGhost
It is also possible to have a prompt for multiple choices, this is the builtin version
This is PSGhost
When -Confirm
is used, it will bring up the choice dialog box.
This is what it looks like in builtin
This is PSGhost
This module is meant to be a proof of concept and is not published to the PSGallery. To try it out you can build the module locally and import it. It requires the dotnet sdk to be available on the PATH.
pwsh -File build.ps1 -Configuration Debug -Task Build
Import-Module -Name ./output/PSGhost
Enable-PSGhost
Contributing is quite easy, fork this repo and submit a pull request with the changes.
To build this module run .\build.ps1 -Task Build
in PowerShell.
To test a build run .\build.ps1 -Task Test
in PowerShell.
This script will ensure all dependencies are installed before running the test suite.