Skip to content

Commit 1095462

Browse files
authored
Merge pull request #563 from dahlbyk/Expand-GitCommand
Export Expand-GitCommand
2 parents ebb94fb + da71c1e commit 1095462

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/GitTabExpansion.ps1

+6-6
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ function script:expandParamValues($cmd, $param, $filter) {
224224
ForEach-Object { -join ("--", $param, "=", $_) }
225225
}
226226

227-
function GitTabExpansion($lastBlock) {
228-
$res = Invoke-Utf8ConsoleCommand { GitTabExpansionInternal $lastBlock $Global:GitStatus }
227+
function Expand-GitCommand($Command) {
228+
$res = Invoke-Utf8ConsoleCommand { GitTabExpansionInternal $Command $Global:GitStatus }
229229
$res
230230
}
231231

@@ -403,7 +403,7 @@ if ($PowerTab_RegisterTabExpansion) {
403403
$line = $Context.Line
404404
$lastBlock = [regex]::Split($line, '[|;]')[-1].TrimStart()
405405
$TabExpansionHasOutput.Value = $true
406-
GitTabExpansion $lastBlock
406+
Expand-GitCommand $lastBlock
407407
}
408408
return
409409
}
@@ -417,9 +417,9 @@ function TabExpansion($line, $lastWord) {
417417

418418
switch -regex ($lastBlock) {
419419
# Execute git tab completion for all git-related commands
420-
"^$(Get-AliasPattern git) (.*)" { GitTabExpansion $lastBlock }
421-
"^$(Get-AliasPattern tgit) (.*)" { GitTabExpansion $lastBlock }
422-
"^$(Get-AliasPattern gitk) (.*)" { GitTabExpansion $lastBlock }
420+
"^$(Get-AliasPattern git) (.*)" { Expand-GitCommand $lastBlock }
421+
"^$(Get-AliasPattern tgit) (.*)" { Expand-GitCommand $lastBlock }
422+
"^$(Get-AliasPattern gitk) (.*)" { Expand-GitCommand $lastBlock }
423423

424424
# Fall back on existing tab expansion
425425
default {

src/posh-git.psd1

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ FunctionsToExport = @(
3333
'Enable-GitColors',
3434
'Get-GitDirectory',
3535
'TabExpansion',
36+
'Expand-GitCommand',
3637
'Get-AliasPattern',
3738
'Get-SshAgent',
3839
'Start-SshAgent',

src/posh-git.psm1

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ $exportModuleMemberParams = @{
148148
'Enable-GitColors',
149149
'Get-GitDirectory',
150150
'TabExpansion',
151+
'Expand-GitCommand',
151152
'Get-AliasPattern',
152153
'Get-SshAgent',
153154
'Start-SshAgent',

0 commit comments

Comments
 (0)