UncommonSense.P2000.psm1
|
$Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue ) $Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue ) foreach ($import in @($Private + $Public)) { try { . $import.fullname } catch { Write-Error -Message "Failed to import function $($import.fullname): $_" } } enum Priority { Unspecified P1 P2 P3 A0 A1 A2 A3 B1 B2 B3 } Register-ArgumentCompleter ` -CommandName 'Get-P2000Entry', 'Get-P2000City' ` -ParameterName 'Region' ` -ScriptBlock { param ( $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter ) Get-P2000Region | Where-Object ID -Like "$wordToComplete*" | Sort-Object -Property ID | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.ID, $_.ID, 'ParameterValue', $_.ID) } } Register-ArgumentCompleter ` -CommandName 'Get-P2000Entry' ` -ParameterName 'City' ` -ScriptBlock { param ( $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter ) Get-P2000City -Region ($fakeBoundParameter['Region'] ) | Where-Object ID -Like "$wordToComplete*" | Sort-Object -Property ID | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.ID, $_.ID, 'ParameterValue', $_.ID) } } |