TabExpansionPlusPlus.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
## TabExpansionPlusPlus custom Completers ##

#
# .SYNOPSIS
#
# Complete the -FilePath argument to Update-ArgumentCompleter
#
function UpdateArgumentFilePathCompleter
{
   param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)

    TabExpansionPlusPlus\Get-ArgumentCompleter | Where-Object File -like *$wordToComplete* | ForEach-Object File | Sort-Object -Unique | Foreach-Object {
        New-CompletionResult "$PSScriptRoot\$_" $_
    }
}


Register-ArgumentCompleter `
    -Command 'Update-ArgumentCompleter' `
    -Parameter 'FilePath' `
    -Description 'Complete the -FilePath argument to Update-ArgumentCompleter: Update-ArgumentCompleter -FilePath <TAB>' `
    -ScriptBlock $function:UpdateArgumentFilePathCompleter