Add support to show suggestions on CommandNotFound exception#8458
Add support to show suggestions on CommandNotFound exception#8458TravisEz13 merged 6 commits intoPowerShell:masterfrom
Conversation
c19e787 to
34e954b
Compare
|
We could consider other names of the parameter: -Fuzzy, -FuzzyMatching, -ShowSuggestions, -Suggestions. We need PowerShell Committee approvement for the new public API. |
|
We could introduce a test hook to do something like write output to the information stream or to a variable for testing purposes for now |
src/System.Management.Automation/engine/hostifaces/HostUtilities.cs
Outdated
Show resolved
Hide resolved
|
@rjmholt I suggest we defer the test hook as that would make sense for testing suggestions in general and not this specific change. |
|
It was good to have a tracking issue if we needed these special tests. |
src/System.Management.Automation/engine/hostifaces/HostUtilities.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/hostifaces/HostUtilities.cs
Outdated
Show resolved
Hide resolved
|
@SteveL-MSFT Do you want to wait on Rob to review your changes? |
|
@TravisEz13 if @rjmholt has further comments, we can treat it as a separate issue and PR. Would like to get this in for next Preview |
|
It would be good to fix some style issues and "s_" before merge. |
|
@PowerShell/powershell-committee reviewed this and is ok with |
…eful in finding close matches
removed use of Tuple and created struct
1d51a6d to
580911b
Compare
PR Summary
Add
-UseFuzzyMatchingswitch toGet-Commandto return commands that fuzzy match to the name in order of closest match to least. Integrate this with the suggestion framework so that on aCommandNotFoundexception, suggestions are shown for likely commands the user intended. The suggestions are part of the console host and write directly to the console so don't see a way to test that. In the future, we should consider changing that to using information stream.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.-UseFuzzyMatchingswitch added toGet-CommandMicrosoftDocs/PowerShell-Docs#3429[feature]if the change is significant or affects feature tests