|
1 | | -# command-not-found |
| 1 | +# command-not-found |
| 2 | + |
| 3 | +The `command-not-found` module is a feedback provider plugin for PowerShell. |
| 4 | +This feedback provider depends on the `command-not-found` utility, |
| 5 | +which is often available on Linux by default, |
| 6 | +to provide suggestions when a native command cannot be found. |
| 7 | + |
| 8 | +`bash` also calls the `command-not-found` utility to provide suggestions when a command cannot be found. |
| 9 | +But this feedback provider plugin does more than that, |
| 10 | +thanks to the [command-line predictor][command-line-predictor] feature in PowerShell. |
| 11 | +It also implements the `ICommandPredictor` interface and serves as a predictor. |
| 12 | +When the resulted feedback contains actionable items, such as commands to run, |
| 13 | +they will be used as predictive suggestions to streamline the user's command-line experience. |
| 14 | + |
| 15 | +</br> |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +## Requirements |
| 20 | + |
| 21 | +The `command-not-found` plugin is built on the `IFeedbackProvider` interface, |
| 22 | +which is available with PowerShell `7.4.0-preview.2` or above. |
| 23 | +To display prediction suggestions from the `command-not-found`, |
| 24 | +you need [PSReadLine 2.2.6][psreadline-226] or above. |
| 25 | + |
| 26 | +- PowerShell `7.4.0-preview.2` or above |
| 27 | +- PSReadLine `2.2.6` or above |
| 28 | + |
| 29 | +## Documentation |
| 30 | + |
| 31 | +PowerShell feedback providers and predictors are written in C# and registered with the PowerShell [Subsystem Plugin Model][subsystem-plugin-model]. |
| 32 | +To learn more, see "How to create a feedback provider" and ["How to create a command-line predictor"][how-to-create-predictor]. |
| 33 | + |
| 34 | +## Build |
| 35 | + |
| 36 | +Make sure the [latest .NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) is installed |
| 37 | +and available in your `PATH` environment variable. |
| 38 | +Run `.\build.ps1` from `pwsh` to build the project. |
| 39 | +The module will be published to `.\bin\command-not-found` by a successful build. |
| 40 | + |
| 41 | + |
| 42 | +[command-line-predictor]: https://learn.microsoft.com/en-us/powershell/scripting/learn/shell/using-predictors?view=powershell-7.3 |
| 43 | +[psreadline-226]: https://www.powershellgallery.com/packages/PSReadLine/2.2.6 |
| 44 | +[subsystem-plugin-model]: https://docs.microsoft.com/powershell/scripting/learn/experimental-features#pssubsystempluginmodel |
| 45 | +[how-to-create-predictor]: https://docs.microsoft.com/powershell/scripting/dev-cross-plat/create-cmdline-predictor |
0 commit comments