Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

bergmeister
Copy link
Collaborator

@bergmeister bergmeister commented Apr 6, 2019

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
Copy link

mkht commented Apr 7, 2019

@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 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 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
Collaborator Author

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

Rules/UseCorrectCasing.cs Outdated Show resolved Hide resolved
Rules/UseCorrectCasing.cs Outdated Show resolved Hide resolved
Tests/Rules/UseCorrectCasing.tests.ps1 Show resolved Hide resolved
Tests/Rules/UseCorrectCasing.tests.ps1 Show resolved Hide resolved
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