Skip to content

UseCorrectCasing: Fix wildcard lookups for command lookup and do not append .exe for applications on Windows - #1210

Merged
Christoph Bergmeister (bergmeister) merged 6 commits into
PowerShell:developmentfrom
bergmeister:DoNotCorrectCasingOfAliases
Apr 16, 2019
Merged

Christoph Bergmeister (bergmeister) merged 6 commits into
PowerShell:developmentfrom
bergmeister:DoNotCorrectCasingOfAliases

Conversation

@bergmeister

@bergmeister Christoph Bergmeister (bergmeister) commented Apr 6, 2019 •

Copy link
Copy Markdown
Collaborator

PR Summary

UseCorrectCasing: Fix command lookups using wildcards, e.g. ? would've wrongly returned ForEach-Object and do not append .exe to binaries on Windows

PR Checklist

… correct application names to end in .exe on Windows
@mkht

mkht commented Apr 7, 2019 •

Copy link
Copy Markdown

Christoph Bergmeister (@bergmeister) Thanks for fixing issue.

In very rare cases, I think the following codes may still produce unexpected results.

> Invoke-Formatter '?et-Content $file'
Get-Content $file

> Invoke-Formatter 'Get-* $file'
Get-AppPackage $file

How about we consider using [WildcardPattern]::Escape() in the Get-Command ?

@bergmeister Christoph Bergmeister (bergmeister) changed the title UseCorrectCasing: Fix special case of ? for command lookup and do not in .exe on Windows UseCorrectCasing: Fix special case of ? for command lookup and do not append .exe for applications on Windows Apr 7, 2019
@bergmeister Christoph Bergmeister (bergmeister) changed the title UseCorrectCasing: Fix special case of ? for command lookup and do not append .exe for applications on Windows UseCorrectCasing: Fix wildcard lookups for command lookup and do not append .exe for applications on Windows Apr 7, 2019
@bergmeister

Copy link
Copy Markdown
Collaborator Author

mkht Thanks for the useful suggestion, I did not know that such an API existed, I applied it

Comment thread Rules/UseCorrectCasing.cs Outdated
Comment thread Rules/UseCorrectCasing.cs
Comment thread Rules/UseCorrectCasing.cs Outdated
Comment thread Tests/Rules/UseCorrectCasing.tests.ps1
Comment thread Tests/Rules/UseCorrectCasing.tests.ps1
Co-Authored-By: bergmeister <c.bergmeister@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alias "?" is changed to "%" by Invoke-Formatter

3 participants