Created
March 1, 2019 13:18
-
-
Save IISResetMe/8e31d823abcd889929412f6ed2b50c7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define an argument completer | |
$completer = { | |
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) | |
if($null -eq $script:_listOfArgCompletions){ | |
# download list and populate $script:_listOfArgComplettions | |
$script:_listOfArgCompletions = @('Apples','Oranges','Nectarines') | |
} | |
$script:_listOfArgCompletions -like "$wordToComplete*" |ForEach-Object { | |
[System.Management.Automation.CompletionResult]::new($_) | |
} | |
} | |
# register it | |
Register-ArgumentCompleter -CommandName Get-CustomThing -ParameterName Name -ScriptBlock $completer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment