1
0
mirror of https://github.com/go-task/task.git synced 2025-07-11 01:20:45 +02:00

Merge pull request #902 from trim21/patch-1

make powershell completion works to fill task name
This commit is contained in:
Andrey Nering
2022-10-29 11:46:45 -03:00
committed by GitHub

View File

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