Skip to content

Include module name and aliased command in suggestions from the PSCommandNotFoundSuggestion  #17768

@StevenBucher98

Description

@StevenBucher98

Summary of the new feature / enhancement

As a user, when I mistype a cmdlet or native command, I want to be able to see suggestions descriptive name and the modules they come from in order to more clearly understand suggestions to help me succeed.

When I mistype a particular command and am returned suggestions, it is unclear what the aliased cmds do and if they are actually related to what I am trying to do or not. For example, when I type gitt I get the following suggestions:

PS C:\Users\stevenbucher> gitt
gitt: The term 'gitt' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Suggestion [4,General]: The most similar commands are: gi, gin, gtz, It, imt.

It is not clear exactly what these aliased commands are and thus I have to investigate further, I have to do Get-Command <cmd> to learn more. This is good but it would be more helpful if this was given to me right after my initial error.

Another example can be when I may type something like

PS C:\Users\stevenbucher> Get-PSResurce
Get-PSResurce: The term 'Get-PSResurce' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Suggestion [4,General]: The most similar commands are: Get-PSResource, Get-AzResource, Get-DscResource, Set-AzResource, Get-PSSession, Get-Service.

It would be helpful to know which modules each of these suggestions came from. Similar to what bash does

stevenbucher@StevenBucherPC:~$ sudi

Command 'sudi' not found, did you mean:

  command 'sudo' from deb sudo (1.8.31-1ubuntu1.2)
  command 'sudo' from deb sudo-ldap (1.8.31-1ubuntu1.2)

Try: sudo apt install <deb name>

I would love to hear other's thoughts on this feature! Thanks!

Proposed technical implementation details (optional)

Have more detailed suggestions for when suggestions are given. See examples below:

PS C:\Users\stevenbucher> gitt
gitt: The term 'gitt' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Suggestion:
CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           gi -> Get-Item
Alias           gin -> Get-ComputerInfo                            7.0.0.0    Microsoft.PowerShell.Management
Alias           gtz -> Get-TimeZone                                7.0.0.0    Microsoft.PowerShell.Management
Function        It                                                 5.3.3      Pester
Alias           imt -> Invoke-PSMDTemplate                         2.2.11.139 PSModuleDevelopment
PS C:\Users\stevenbucher> Get-PSresurce
Get-PSresurce: The term 'Get-PSresurce' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Suggestion: 
CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Get-PSResource                                     3.0.12     PowerShellGet
Cmdlet          Get-AzResource                                     6.0.1      Az.Resources
Function        Get-DscResource                                    1.1        PSDesiredStateConfiguration
Cmdlet          Set-AzResource                                     6.0.1      Az.Resources
Function        Get-PSFFeature                                     1.7.237    PSFramework
Function        Get-PSFMessage                                     1.7.237    PSFramework

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions