From e60cbb81bb697de0a23d8d92dd498c376c11dc9d Mon Sep 17 00:00:00 2001 From: David Gardiner Date: Wed, 23 May 2018 08:42:55 +0930 Subject: [PATCH] Move switch cases to the end - Following @rkeithhill's suggestion --- src/GitTabExpansion.ps1 | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/GitTabExpansion.ps1 b/src/GitTabExpansion.ps1 index 1c8002e32..52a9099e9 100644 --- a/src/GitTabExpansion.ps1 +++ b/src/GitTabExpansion.ps1 @@ -276,23 +276,6 @@ function GitTabExpansionInternal($lastBlock, $GitStatus = $null) { switch -regex ($lastBlock -replace "^$(Get-AliasPattern git) ","") { - # Handles git pr alias - "vsts\.pr\s+(?\S*)$" { - gitCmdOperations $subcommands 'vsts.pr' $matches['op'] - } - - # Handles git pr -- - "vsts\.pr\s+(?$vstsCommandsWithLongParams).*--(?\S*)$" - { - expandLongParams $longVstsParams $matches['cmd'] $matches['param'] - } - - # Handles git pr - - "vsts\.pr\s+(?$vstsCommandsWithShortParams).*-(?\S*)$" - { - expandShortParams $shortVstsParams $matches['cmd'] $matches['shortparam'] - } - # Handles git "^(?$($subcommands.Keys -join '|'))\s+(?\S*)$" { gitCmdOperations $subcommands $matches['cmd'] $matches['op'] @@ -436,6 +419,24 @@ function GitTabExpansionInternal($lastBlock, $GitStatus = $null) { "^(?$gitCommandsWithShortParams).* -(?\S*)$" { expandShortParams $shortGitParams $matches['cmd'] $matches['shortparam'] } + + # Handles git pr alias + "vsts\.pr\s+(?\S*)$" { + gitCmdOperations $subcommands 'vsts.pr' $matches['op'] + } + + # Handles git pr -- + "vsts\.pr\s+(?$vstsCommandsWithLongParams).*--(?\S*)$" + { + expandLongParams $longVstsParams $matches['cmd'] $matches['param'] + } + + # Handles git pr - + "vsts\.pr\s+(?$vstsCommandsWithShortParams).*-(?\S*)$" + { + expandShortParams $shortVstsParams $matches['cmd'] $matches['shortparam'] + } + } }