Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/JustinGrote/ScriptPredictor


https://github.com/JustinGrote/ScriptPredictor

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# ScriptPredictor

This is an implementation of the PowerShell prediction subsystem that allows you to specify any scriptblock as a prediction plugin, similar to how Argument Completers work. Unfortunately it's not very useful at the moment due to a 20ms runtime restriction on prediction subsystems - https://github.com/PowerShell/PSReadLine/issues/3607

## Quick Start

```powershell
Install-Module ScriptPredictor
Import-Module ScriptPredictor
Set-PSReadlineOption -PredictionSource Plugin
Register-ScriptPredictor -Name 'RandomNumberAppend' {
$PSItem + (Get-Random)
}
#Anything you type at the prompt should now predict a random number after it. This may take a few tries for the runspace to "warm up" and operate under the 20ms limit.
```