Change CommandInfo lookup for commands in the form `module\cmdletName` by liamjpeters · Pull Request #2125 · PowerShell/PSScriptAnalyzer
PR Summary
When the CommandInfoCache is used to lookup some fully qualified commands (by way of Get-Command), a nested module name is returned.
PR changes CommandInfoCache when a CommandInfo is looked up for a command in the form module\cmdletName. It passes this module name hint along to Get-Command to allow correct resolution.
With the MicrosoftTeams module installed, as an example, running:
Get-Command -Name 'MicrosoftTeams\Get-CsOnlineLisCivicAddress'
Reports the commands module as Microsoft.Teams.ConfigAPI.Cmdlets.
Instead running:
Get-Command -Name 'Get-CsOnlineLisCivicAddress' -Module 'MicrosoftTeams'
Correctly reports the module as MicrosoftTeams.
Also happens for Az.resources\Get-AzRoleEligibilitySchedule
PR Checklist
- PR has a meaningful title
- Use the present tense and imperative mood when describing your changes
- Summarized changes
- Change is not breaking
- Make sure all
.cs,.ps1and.psm1files have the correct copyright header - Make sure you've added a new test if existing tests do not effectively test the code changed and/or updated documentation
- This PR is ready to merge and is not Work in Progress.
- If the PR is work in progress, please add the prefix
WIP:to the beginning of the title and remove the prefix when the PR is ready.
- If the PR is work in progress, please add the prefix