From 68ecb7fbdd42014d6c7a44d264eb8104b9f37412 Mon Sep 17 00:00:00 2001 From: Paul Varache Date: Mon, 20 Jan 2020 11:26:15 +0000 Subject: [PATCH] Add PowerShell completion script --- completion/ps/task.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 completion/ps/task.ps1 diff --git a/completion/ps/task.ps1 b/completion/ps/task.ps1 new file mode 100644 index 00000000..948d333e --- /dev/null +++ b/completion/ps/task.ps1 @@ -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