Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JustinGrote/ScriptPredictor
https://github.com/JustinGrote/ScriptPredictor
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/JustinGrote/ScriptPredictor
- Owner: JustinGrote
- License: mit
- Created: 2023-03-04T19:19:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-03-04T19:19:56.000Z (over 1 year ago)
- Last Synced: 2024-07-12T01:48:17.105Z (4 months ago)
- Language: PowerShell
- Size: 5.86 KB
- Stars: 6
- 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.
```