Skip to content

Instantly share code, notes, and snippets.

@bielawb
Created November 29, 2016 18:44
Show Gist options
  • Save bielawb/30fd5d9d43d1ac094833bff2a855054b to your computer and use it in GitHub Desktop.
Save bielawb/30fd5d9d43d1ac094833bff2a855054b to your computer and use it in GitHub Desktop.
TabExpansion for Should
Register-ArgumentCompleter -Native -CommandName Should -ScriptBlock {
param ($WordToComplete, $CommandAst)
$options = @(
'Be'
'BeExactly'
'BeLike'
'BeGreaterThan'
'BeLessThan'
'Contain'
'Match'
'MatchExactly'
'BeNullOrEmpty'
'Not'
)
$options | Where-Object { $_ -like "$WordToComplete*" } | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment