forked from lzybkr/TabExpansionPlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScheduledTasks.ArgumentCompleters.ps1
42 lines (38 loc) · 1.28 KB
/
ScheduledTasks.ArgumentCompleters.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#
# .SYNOPSIS
#
# Complete the -TaskName argument to ScheduledTask module cmdlets
#
function ScheduledTaskTaskNameArgumentCompletion
{
[ArgumentCompleter(
Parameter = 'TaskName',
Command = { Get-Command -Module ScheduledTasks -ParameterName TaskName },
Description = 'Complete task names')]
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
Get-ScheduledTask -TaskName "$wordToComplete*" |
Sort-Object TaskName |
ForEach-Object {
New-CompletionResult $_.TaskName $_.Description
}
}
#
# .SYNOPSIS
#
# Complete the -TaskPath argument to ScheduledTask module cmdlets
#
function ScheduledTaskTaskPathArgumentCompletion
{
[ArgumentCompleter(
Parameter = 'TaskPath',
Command = {
# REVIEW: should Set-ScheduledTask be excluded?
Get-Command -Module ScheduledTasks -ParameterName TaskPath },
Description = 'Complete task path arguments for scheduled task cmdlets')]
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
Get-ScheduledTask -TaskPath "*$wordToComplete*" |
Sort-Object TaskPath |
ForEach-Object {
New-CompletionResult $_.TaskPath $_.Description
}
}