Skip to content

Commit 32b097b

Browse files
authored
Merge pull request #281 from paulvarache/ps-complete
Add PowerShell completion script
2 parents de98a53 + 68ecb7f commit 32b097b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

completion/ps/task.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$scriptBlock = {
2+
param($commandName, $wordToComplete, $cursorPosition)
3+
$curReg = "task{.exe}? (.*?)$"
4+
$startsWith = $wordToComplete | Select-String $curReg -AllMatches | ForEach-Object { $_.Matches.Groups[1].Value }
5+
$reg = "\* ($startsWith.+?):"
6+
$listOutput = $(task -l)
7+
$listOutput | Select-String $reg -AllMatches | ForEach-Object { $_.Matches.Groups[1].Value + " " }
8+
}
9+
10+
Register-ArgumentCompleter -Native -CommandName task -ScriptBlock $scriptBlock

0 commit comments

Comments
 (0)