Skip to content

Commit

Permalink
Support tab expansion for commands behind simple git aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlbyk committed Dec 1, 2010
1 parent 5ed95ee commit ed18e09
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions GitTabExpansion.ps1
Expand Up @@ -89,7 +89,19 @@ function script:gitAliases($filter) {
} | Sort
}

function script:expandGitAlias($cmd, $rest) {
if((git config --get-regexp "^alias\.$cmd`$") -match "^alias\.$cmd (?<cmd>[^!]\S+) .*`$") {
return "git $($Matches['cmd'])$rest"
} else {
return "git $cmd$rest"
}
}

function GitTabExpansion($lastBlock) {
if($lastBlock -match '^git (?<cmd>\S+)(?<args> .*)$') {
$lastBlock = expandGitAlias $Matches['cmd'] $Matches['args']
}

switch -regex ($lastBlock) {

# Handles tgit <command> (tortoisegit)
Expand Down

0 comments on commit ed18e09

Please sign in to comment.