Skip to content

Commit

Permalink
Basic support for expanding 'git tfs <tab>' and 'git tfs unshelve <tab>'
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlbyk committed Feb 18, 2012
1 parent 83dfee0 commit 28f4adf
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion GitTabExpansion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ $global:ops = @{
remote = 'add','rename','rm','set-head','show','prune','update'
stash = 'list','show','drop','pop','apply','branch','save','clear','create'
svn = 'init', 'fetch', 'clone', 'rebase', 'dcommit', 'branch', 'tag', 'log', 'blame', 'find-rev', 'set-tree', 'create-ignore', 'show-ignore', 'mkdirs', 'commit-diff', 'info', 'proplist', 'propget', 'show-externals', 'gc', 'reset'
tfs = 'bootstrap','checkin','checkintool','ct','cleanup','cleanup-workspaces','clone','diagnostics','fetch','help','init','pull','quick-clone','rcheckin','shelve','shelve-list','unshelve','verify'
}

function script:gitCmdOperations($command, $filter) {
Expand Down Expand Up @@ -60,6 +61,12 @@ function script:gitStashes($filter) {
foreach { "'$_'" }
}

function script:gitTfsShelvesets($filter) {
(git tfs shelve-list) |
where { $_ -like "$filter*" } |
foreach { "'$_'" }
}

function script:gitIndex($filter) {
if($GitStatus) {
$GitStatus.Index |
Expand Down Expand Up @@ -121,7 +128,8 @@ function GitTabExpansion($lastBlock) {
# Handles git remote <op>
# Handles git stash <op>
# Handles git svn <op>
"^(?<cmd>reflog|remote|stash|svn)\s+(?<op>\S*)$" {
# Handles git tfs <op>
"^(?<cmd>reflog|remote|stash|svn|tfs)\s+(?<op>\S*)$" {
gitCmdOperations $matches['cmd'] $matches['op']
}

Expand All @@ -135,6 +143,11 @@ function GitTabExpansion($lastBlock) {
gitStashes $matches['stash']
}

# Handles git tfs unshelve <shelveset>
"^tfs +unshelve.* (?<shelveset>\S*)$" {
gitTfsShelvesets $matches['shelveset']
}

# Handles git branch -d|-D|-m|-M <branch name>
# Handles git branch <branch name> <start-point>
"^branch.* (?<branch>\S*)$" {
Expand Down

0 comments on commit 28f4adf

Please sign in to comment.