-
-
Notifications
You must be signed in to change notification settings - Fork 813
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
Fix #854 - PowerShell aliases against app with .exe ext doesn't work #855
Fix #854 - PowerShell aliases against app with .exe ext doesn't work #855
Conversation
Add RegisteredCommands field to GitTabSettings for debug purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing blocking, but a few questions/ideas.
src/GitTabExpansion.ps1
Outdated
@@ -537,10 +538,21 @@ function WriteTabExpLog([string] $Message) { | |||
|
|||
if (!$UseLegacyTabExpansion -and ($PSVersionTable.PSVersion.Major -ge 6)) { | |||
$cmdNames = "git","tgit","gitk" | |||
|
|||
# Create regex pattern from $cmdNames: ^(git|git\.exe|tgit|tgit\.exe|gitk|gitk\.exe)$ | |||
$cmdNamesPattern = "^($(($cmdNames | ForEach-Object { "${_}|${_}\.exe" }) -join '|'))$" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simpler to just optionally match .exe
at the end?
$cmdNamesPattern = "^($(($cmdNames | ForEach-Object { "${_}|${_}\.exe" }) -join '|'))$" | |
$cmdNamesPattern = "^($($cmdNames -join '|'))(\.exe)?$" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/GitUtils.ps1
Outdated
@@ -442,7 +442,7 @@ function InDotGitOrBareRepoDir([string][ValidateNotNullOrEmpty()]$GitDir) { | |||
} | |||
|
|||
function Get-AliasPattern($cmd) { | |||
$aliases = @($cmd) + @(Get-Alias | Where-Object { $_.Definition -eq $cmd } | Select-Object -Exp Name) | |||
$aliases = @($cmd) + @(Get-Alias | Where-Object { $_.Definition -match "^($cmd|$cmd\.exe)$" } | Foreach-Object Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$aliases = @($cmd) + @(Get-Alias | Where-Object { $_.Definition -match "^($cmd|$cmd\.exe)$" } | Foreach-Object Name) | |
$aliases = @($cmd) + @(Get-Alias | Where-Object { $_.Definition -match "^$cmd(\.exe)?$" } | Foreach-Object Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
# Create regex pattern from $funcNames e.g.: ^(Git-Checkout|Git-Switch)$ | ||
$funcNamesPattern = "^($($funcNames -join '|'))$" | ||
$cmdNames += Get-Alias | Where-Object { $_.Definition -match $funcNamesPattern } | Foreach-Object Name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test for helper function alias match?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Thanks! |
Add RegisteredCommands field to GitTabSettings for debug purposes.