1
0
mirror of https://github.com/go-task/task.git synced 2025-01-14 04:35:50 +02:00

Merge pull request #281 from paulvarache/ps-complete

Add PowerShell completion script
This commit is contained in:
Andrey Nering 2020-01-26 17:16:57 -03:00 committed by GitHub
commit 32b097b3f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

10
completion/ps/task.ps1 Normal file
View File

@ -0,0 +1,10 @@
$scriptBlock = {
param($commandName, $wordToComplete, $cursorPosition)
$curReg = "task{.exe}? (.*?)$"
$startsWith = $wordToComplete | Select-String $curReg -AllMatches | ForEach-Object { $_.Matches.Groups[1].Value }
$reg = "\* ($startsWith.+?):"
$listOutput = $(task -l)
$listOutput | Select-String $reg -AllMatches | ForEach-Object { $_.Matches.Groups[1].Value + " " }
}
Register-ArgumentCompleter -Native -CommandName task -ScriptBlock $scriptBlock