forked from JeremySkinner/posh-svn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SvnTabExpansion.ps1
78 lines (73 loc) · 3.03 KB
/
SvnTabExpansion.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
function SvnTabExpansion($lastBlock) {
switch -regex ($lastBlock) {
#handles svn help <cmd>
#handles svn <cmd>
'svn (help )?(\S*)$' {
svnCommands($matches[2]);
}
'tsvn (\S*)$' {
tortoiseSvnCommands($matches[1]);
}
}
}
function svnCommands($filter) {
$cmdList = @()
$output = svn help
foreach($line in $output) {
if($line -match '^ (\S+)(.*)') {
$cmd = $matches[1]
if($filter -and $cmd.StartsWith($filter)) {
$cmdList += $cmd.Trim();
}
elseif(-not $filter) {
$cmdList += $cmd.Trim();
}
}
}
$cmdList | sort
}
function tortoiseSvnCommands($filter) {
if($filter) {
return $tsvnCommands.keys | where { $tsvnCommands[$_].cmd.StartsWith($filter) } | sort
}
else {
return $tsvnCommands.keys | sort
}
}
$tsvnCommands = @{
"about" = @{ cmd = "about"; useCurrentDirectory = $false };
"log" = @{ cmd = "log"; useCurrentDirectory = $true };
"checkout" = @{ cmd = "checkout"; useCurrentDirectory = $false };
"import" = @{ cmd = "import"; useCurrentDirectory = $false };
"update" = @{ cmd = "update"; useCurrentDirectory = $true };
"commit" = @{ cmd = "commit"; useCurrentDirectory = $true };
"add" = @{ cmd = "add"; useCurrentDirectory = $false };
"revert" = @{ cmd = "revert"; useCurrentDirectory = $false };
"cleanup" = @{ cmd = "cleanup"; useCurrentDirectory = $false };
"resolve" = @{ cmd = "resolve"; useCurrentDirectory = $false };
"repocreate" = @{ cmd = "repocreate"; useCurrentDirectory = $false };
"switch" = @{ cmd = "switch"; useCurrentDirectory = $true };
"export" = @{ cmd = "export"; useCurrentDirectory = $false };
"merge" = @{ cmd = "merge"; useCurrentDirectory = $false };
"mergeall" = @{ cmd = "mergeall"; useCurrentDirectory = $false };
"copy" = @{ cmd = "copy"; useCurrentDirectory = $false };
"settings" = @{ cmd = "settings"; useCurrentDirectory = $false };
"remove" = @{ cmd = "remove"; useCurrentDirectory = $false };
"rename" = @{ cmd = "rename"; useCurrentDirectory = $false };
"diff" = @{ cmd = "diff"; useCurrentDirectory = $false };
"showcompare" = @{ cmd = "showcompare"; useCurrentDirectory = $false };
"conflicteditor" = @{ cmd = "conflicteditor"; useCurrentDirectory = $false };
"relocate" = @{ cmd = "relocate"; useCurrentDirectory = $false };
"help" = @{ cmd = "help"; useCurrentDirectory = $false };
"repostatus" = @{ cmd = "repostatus"; useCurrentDirectory = $false };
"repobrowser" = @{ cmd = "repobrowser"; useCurrentDirectory = $false };
"ignore" = @{ cmd = "ignore"; useCurrentDirectory = $false };
"blame" = @{ cmd = "blame"; useCurrentDirectory = $false };
"cat" = @{ cmd = "cat"; useCurrentDirectory = $false };
"createpatch" = @{ cmd = "createpatch"; useCurrentDirectory = $false };
"revisiongraph" = @{ cmd = "revisiongraph"; useCurrentDirectory = $false };
"lock" = @{ cmd = "lock"; useCurrentDirectory = $false };
"unlock" = @{ cmd = "unlock"; useCurrentDirectory = $false };
"rebuildiconcache" = @{ cmd = "rebuildiconcache"; useCurrentDirectory = $false };
"properties" = @{ cmd = "properties"; useCurrentDirectory = $false };
}