Skip to content

Commit

Permalink
Move switch cases to the end
Browse files Browse the repository at this point in the history
- Following @rkeithhill's suggestion
  • Loading branch information
flcdrg committed May 22, 2018
1 parent 489dabc commit e60cbb8
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/GitTabExpansion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -276,23 +276,6 @@ function GitTabExpansionInternal($lastBlock, $GitStatus = $null) {

switch -regex ($lastBlock -replace "^$(Get-AliasPattern git) ","") {

# Handles git pr alias
"vsts\.pr\s+(?<op>\S*)$" {
gitCmdOperations $subcommands 'vsts.pr' $matches['op']
}

# Handles git pr <cmd> --<param>
"vsts\.pr\s+(?<cmd>$vstsCommandsWithLongParams).*--(?<param>\S*)$"
{
expandLongParams $longVstsParams $matches['cmd'] $matches['param']
}

# Handles git pr <cmd> -<shortparam>
"vsts\.pr\s+(?<cmd>$vstsCommandsWithShortParams).*-(?<shortparam>\S*)$"
{
expandShortParams $shortVstsParams $matches['cmd'] $matches['shortparam']
}

# Handles git <cmd> <op>
"^(?<cmd>$($subcommands.Keys -join '|'))\s+(?<op>\S*)$" {
gitCmdOperations $subcommands $matches['cmd'] $matches['op']
Expand Down Expand Up @@ -436,6 +419,24 @@ function GitTabExpansionInternal($lastBlock, $GitStatus = $null) {
"^(?<cmd>$gitCommandsWithShortParams).* -(?<shortparam>\S*)$" {
expandShortParams $shortGitParams $matches['cmd'] $matches['shortparam']
}

# Handles git pr alias
"vsts\.pr\s+(?<op>\S*)$" {
gitCmdOperations $subcommands 'vsts.pr' $matches['op']
}

# Handles git pr <cmd> --<param>
"vsts\.pr\s+(?<cmd>$vstsCommandsWithLongParams).*--(?<param>\S*)$"
{
expandLongParams $longVstsParams $matches['cmd'] $matches['param']
}

# Handles git pr <cmd> -<shortparam>
"vsts\.pr\s+(?<cmd>$vstsCommandsWithShortParams).*-(?<shortparam>\S*)$"
{
expandShortParams $shortVstsParams $matches['cmd'] $matches['shortparam']
}

}
}

Expand Down

0 comments on commit e60cbb8

Please sign in to comment.