https://github.com/JustinGrote/ScriptPredictor
https://github.com/JustinGrote/ScriptPredictor
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/JustinGrote/ScriptPredictor
- Owner: JustinGrote
- License: mit
- Created: 2023-03-04T19:19:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-04T19:19:56.000Z (over 2 years ago)
- Last Synced: 2024-12-01T12:45:21.876Z (7 months ago)
- Language: PowerShell
- Size: 5.86 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - JustinGrote/ScriptPredictor - (PowerShell)
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.
```