Permalink
Browse files

Add support for TortoiseGit tab expansion

  • Loading branch information...
1 parent 242138d commit 2eb6bb003eb03f218f4e6d2a4486492211eb48b6 @JeremySkinner JeremySkinner committed with dahlbyk Jun 26, 2010
Showing with 71 additions and 1 deletion.
  1. +7 −0 GitTabExpansion.ps1
  2. +60 −0 TortoiseGit.ps1
  3. +4 −1 posh-git.psm1
View
@@ -83,6 +83,13 @@ function script:gitAliases($filter) {
function GitTabExpansion($lastBlock) {
switch -regex ($lastBlock) {
+
+ # Handles tgit <command> (tortoisegit)
+ 'tgit (\S*)$' {
+ # Need return statement to prevent fall-through.
+ return $tortoiseGitCommands | where { $_ -like "$($matches[1])*" }
+ }
+
# Handles git remote <op>
# Handles git stash <op>
'git (remote|stash|svn) (\S*)$' {
View
@@ -0,0 +1,60 @@
+# TortoiseGit
+
+$Global:TortoiseGitSettings = new-object PSObject -Property @{
+ TortoiseGitPath = "C:\Program Files\TortoiseGit\bin\TortoiseProc.exe"
+}
+
+function tgit {
+ if($args) {
+ if($args[0] -eq "help") {
+ # Replace the built-in help behaviour with just a list of commands
+ $tortoiseGitCommands
+ return
+ }
+
+ $newArgs = @()
+ $newArgs += "/command:" + $args[0]
+
+ $cmd = $args[0]
+
+ if($args.length -gt 1) {
+ $args[1..$args.length] | % { $newArgs += $_ }
+ }
+
+ & $Global:TortoiseGitSettings.TortoiseGitPath $newArgs
+ }
+}
+
+$tortoiseGitCommands = @(
+"about",
+"log",
+"commit",
+"add",
+"revert",
+"cleanup" ,
+"resolve",
+"switch",
+"export",
+"merge",
+"settings",
+"remove",
+"rename",
+"diff",
+"conflicteditor",
+"help",
+"ignore",
+"blame",
+"cat",
+"createpatch",
+"pull",
+"push",
+"rebase",
+"stashsave",
+"stashapply",
+"subadd",
+"subupdate",
+"subsync",
+"reflog",
+"refbrowse",
+"sync"
+) | sort
View
@@ -3,11 +3,14 @@ Push-Location $psScriptRoot
. ./GitUtils.ps1
. ./GitPrompt.ps1
. ./GitTabExpansion.ps1
+. ./TortoiseGit.ps1
Pop-Location
Export-ModuleMember -Function @(
'Write-GitStatus',
'Get-GitStatus',
'Enable-GitColors',
'Get-GitDirectory',
- 'GitTabExpansion')
+ 'GitTabExpansion',
+ 'tgit')
+

0 comments on commit 2eb6bb0

Please sign in to comment.