Skip to content

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

New issue

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

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

Already on GitHub? # to your account

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

Co-Authored-By: bergmeister <c.bergmeister@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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