@@ -32,7 +32,7 @@ function Get-GITModeHint {
32
32
}
33
33
$script :paramHints .$Command.add (" *" , $modeTable )
34
34
}
35
-
35
+
36
36
# Create the results
37
37
if ($script :paramHints .$Command ." *" .containsKey($Mode ))
38
38
{
@@ -62,28 +62,19 @@ function Get-GITParameterHint {
62
62
if (-not $script :paramHints.containsKey ($Command )) { $script :paramHints.add ($Command , @ {}) }
63
63
# Populate the "mode branch" if empty
64
64
if (-not $script :paramHints .$Command.containsKey ($Mode )) {
65
- $helpStrings = Invoke-Utf8ConsoleCommand { & $Command $Mode - h 2>&1 }
66
- $exceptions = @ (" diff" )
65
+ $helpStrings = Invoke-Utf8ConsoleCommand { & $Command - C " $ ( $env: temp ) " -- no- pager $Mode - h 2>&1 }
67
66
$preProcessedStrings = @ ()
68
67
# Preprocessing
69
68
foreach ($line in $helpStrings )
70
69
{
71
70
switch - RegEx ($line ) {
72
- " ^\s{2,2}(-.*)$" {
73
- # this a line defining a parameter, if we are in git diff
74
- if ($Mode -like " diff" ) { $preProcessedStrings += " $ ( $Matches [1 ]) " }
75
- }
76
- " ^\s{15,15}(\s.*)$" {
77
- # this line belongs to the parameter description of the line before in git diff
78
- if ($Mode -like " diff" ) { $preProcessedStrings [-1 ] = " $ ( $preProcessedStrings [-1 ]) $ ( $Matches [1 ]) " }
79
- }
80
71
" ^\s{4,4}(-.*)$" {
81
72
# this is a line defining a parameter
82
- if ( $Mode -notin $exceptions ) { $ preProcessedStrings += " $ ( $Matches [1 ]) " }
73
+ $ preProcessedStrings += " $ ( $Matches [1 ]) "
83
74
}
84
75
" ^\s{25,25}(\s.*)$" {
85
76
# this line belongs to the parameter description of the line before
86
- if ( $Mode -notin $exceptions ) { $ preProcessedStrings [-1 ] = " $ ( $preProcessedStrings [-1 ]) $ ( $Matches [1 ]) " }
77
+ $ preProcessedStrings [-1 ] = " $ ( $preProcessedStrings [-1 ]) $ ( $Matches [1 ]) "
87
78
}
88
79
}
89
80
}
@@ -171,7 +162,7 @@ function Add-HintsToParams {
171
162
172
163
# We are only handling git at the moment
173
164
if ($Command -notmatch " ^$ ( Get-AliasPattern git) (.*)" ) { return $PossibleParams }
174
-
165
+
175
166
# Determing git mode, which is the first parameter without dashes, but not the last one, which is "" or an incomplete parameter
176
167
$cmdMode = $null
177
168
for ($i = 1 ; $i -lt $cmdParts.length - 1 ; $i ++ ) {
@@ -180,7 +171,7 @@ function Add-HintsToParams {
180
171
break
181
172
}
182
173
}
183
-
174
+
184
175
$newTabCompletions = @ ()
185
176
if ($cmdMode ) {
186
177
# we're searching a parameter for mode $cmdMode
0 commit comments