Skip to content

Commit 28842c3

Browse files
authored
Update README.md (#2)
1 parent cd0291f commit 28842c3

File tree

3 files changed

+49
-5
lines changed

3 files changed

+49
-5
lines changed

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,45 @@
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+
![FeedbackProvider](./tools/images/FeedbackProvider.gif)
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

src/FeedbackProvider.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
namespace Microsoft.PowerShell.FeedbackProvider;
88

9-
public sealed class UnixCommandNotFound : IFeedbackProvider, ICommandPredictor
9+
public sealed class LinuxCommandNotFound : IFeedbackProvider, ICommandPredictor
1010
{
1111
private readonly Guid _guid;
1212
private List<string>? _candidates;
1313

14-
internal UnixCommandNotFound(string guid)
14+
internal LinuxCommandNotFound(string guid)
1515
{
1616
_guid = new Guid(guid);
1717
}
@@ -22,7 +22,7 @@ internal UnixCommandNotFound(string guid)
2222

2323
public string Name => "cmd-not-found";
2424

25-
public string Description => "The built-in feedback/prediction source for the Unix command utility.";
25+
public string Description => "The built-in feedback/prediction source for the Linux command utility.";
2626

2727
#region IFeedbackProvider
2828

@@ -176,7 +176,7 @@ public class Init : IModuleAssemblyInitializer, IModuleAssemblyCleanup
176176

177177
public void OnImport()
178178
{
179-
var feedback = new UnixCommandNotFound(Id);
179+
var feedback = new LinuxCommandNotFound(Id);
180180
SubsystemManager.RegisterSubsystem(SubsystemKind.FeedbackProvider, feedback);
181181
SubsystemManager.RegisterSubsystem(SubsystemKind.CommandPredictor, feedback);
182182
}

tools/images/FeedbackProvider.gif

90.1 KB
Loading

0 commit comments

Comments
 (0)