diff --git a/src/completers.ps1 b/src/completers.ps1 index 901d1de8e..9cc61195a 100644 --- a/src/completers.ps1 +++ b/src/completers.ps1 @@ -7,7 +7,11 @@ Verbose = $false Debug = $false } - Get-GitHubAppInstallation @params | Where-Object { $_.Type -eq 'User' -and $_.Target.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubAppInstallation @params | Where-Object { $_.Type -eq 'User' -and $_.Target.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Target.Name, $_.Target.Name, 'ParameterValue', $_.Target.Name) } } @@ -20,7 +24,11 @@ Register-ArgumentCompleter -CommandName Connect-GitHubApp -ParameterName Organiz Verbose = $false Debug = $false } - Get-GitHubAppInstallation @params | Where-Object { $_.Type -eq 'Organization' -and $_.Target.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubAppInstallation @params | Where-Object { $_.Type -eq 'Organization' -and $_.Target.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Target.Name, $_.Target.Name, 'ParameterValue', $_.Target.Name) } } @@ -33,7 +41,11 @@ Register-ArgumentCompleter -CommandName Connect-GitHubApp -ParameterName Enterpr Verbose = $false Debug = $false } - Get-GitHubAppInstallation @params | Where-Object { $_.Type -eq 'Enterprise' -and $_.Target.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubAppInstallation @params | Where-Object { $_.Type -eq 'Enterprise' -and $_.Target.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Target.Name, $_.Target.Name, 'ParameterValue', $_.Target.Name) } } diff --git a/src/functions/public/Auth/Context/completers.ps1 b/src/functions/public/Auth/Context/completers.ps1 index 9f4c2752d..c2eb1dee3 100644 --- a/src/functions/public/Auth/Context/completers.ps1 +++ b/src/functions/public/Auth/Context/completers.ps1 @@ -14,7 +14,11 @@ $contexts += Get-GitHubContext -ListAvailable -Verbose:$false -Debug:$false $contexts = $contexts | Sort-Object -Property Name - $contexts | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = $contexts | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } diff --git a/src/functions/public/Config/completers.ps1 b/src/functions/public/Config/completers.ps1 index c498f0497..6127bf086 100644 --- a/src/functions/public/Config/completers.ps1 +++ b/src/functions/public/Config/completers.ps1 @@ -2,7 +2,11 @@ param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) $null = $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters $pattern = switch (Get-GitHubConfig -Name CompletionMode) { 'Contains' { "*$wordToComplete*" } default { "$wordToComplete*" } } - ([GitHubConfig]).GetProperties().Name | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = ([GitHubConfig]).GetProperties().Name | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_ ) } } @@ -13,17 +17,29 @@ Register-ArgumentCompleter -CommandName Set-GitHubConfig -ParameterName Value -S $pattern = switch (Get-GitHubConfig -Name CompletionMode) { 'Contains' { "*$wordToComplete*" } default { "$wordToComplete*" } } switch ($fakeBoundParameters.Name) { 'CompletionMode' { - @('StartsWith', 'Contains') | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = @('StartsWith', 'Contains') | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } 'HttpVersion' { - @('1.0', '1.1', '2.0', '3.0') | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = @('1.0', '1.1', '2.0', '3.0') | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } 'EnvironmentType' { - @('Local', 'GitHubActions', 'FunctionApp', 'Unknown') | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = @('Local', 'GitHubActions', 'FunctionApp', 'Unknown') | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } @@ -33,12 +49,20 @@ Register-ArgumentCompleter -CommandName Set-GitHubConfig -ParameterName Value -S Debug = $false Verbose = $false } - Get-GitHubApiVersion @params | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubApiVersion @params | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } 'DefaultContext' { - Get-GitHubContext -ListAvailable | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubContext -ListAvailable | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } diff --git a/src/functions/public/Environments/completers.ps1 b/src/functions/public/Environments/completers.ps1 index e2f9422f4..4e121eacb 100644 --- a/src/functions/public/Environments/completers.ps1 +++ b/src/functions/public/Environments/completers.ps1 @@ -11,7 +11,11 @@ Debug = $false } $params | Remove-HashtableEntry -NullOrEmptyValues - Get-GitHubEnvironment @params | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubEnvironment @params | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } @@ -28,7 +32,11 @@ Register-ArgumentCompleter -CommandName ($script:PSModuleInfo.FunctionsToExport) Debug = $false } $params | Remove-HashtableEntry -NullOrEmptyValues - Get-GitHubEnvironment @params | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubEnvironment @params | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } diff --git a/src/functions/public/Gitignore/completers.ps1 b/src/functions/public/Gitignore/completers.ps1 index 86d7df84e..e6a60acdd 100644 --- a/src/functions/public/Gitignore/completers.ps1 +++ b/src/functions/public/Gitignore/completers.ps1 @@ -7,7 +7,11 @@ Verbose = $false Debug = $false } - Get-GitHubGitignore @params | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubGitignore @params | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } diff --git a/src/functions/public/License/completers.ps1 b/src/functions/public/License/completers.ps1 index a4c5a4f10..677059f67 100644 --- a/src/functions/public/License/completers.ps1 +++ b/src/functions/public/License/completers.ps1 @@ -7,7 +7,11 @@ Verbose = $false Debug = $false } - Get-GitHubLicense @params | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubLicense @params | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } diff --git a/src/functions/public/Organization/completers.ps1 b/src/functions/public/Organization/completers.ps1 index 2994f0240..59cf3b2c1 100644 --- a/src/functions/public/Organization/completers.ps1 +++ b/src/functions/public/Organization/completers.ps1 @@ -8,7 +8,11 @@ Verbose = $false Debug = $false } - Get-GitHubOrganization @params | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubOrganization @params | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } @@ -22,7 +26,11 @@ Register-ArgumentCompleter -CommandName ($script:PSModuleInfo.FunctionsToExport) Verbose = $false Debug = $false } - Get-GitHubOrganization @params | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubOrganization @params | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } @@ -36,7 +44,11 @@ Register-ArgumentCompleter -CommandName ($script:PSModuleInfo.FunctionsToExport) Verbose = $false Debug = $false } - Get-GitHubOrganization @params | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubOrganization @params | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } diff --git a/src/functions/public/Permission/completers.ps1 b/src/functions/public/Permission/completers.ps1 index dc0be7453..d49392053 100644 --- a/src/functions/public/Permission/completers.ps1 +++ b/src/functions/public/Permission/completers.ps1 @@ -2,7 +2,11 @@ param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) $null = $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters $pattern = switch (Get-GitHubConfig -Name CompletionMode) { 'Contains' { "*$wordToComplete*" } default { "$wordToComplete*" } } - [GitHubPermissionDefinition]::List.Name | Sort-Object -Unique | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = [GitHubPermissionDefinition]::List.Name | Sort-Object -Unique | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } @@ -11,7 +15,11 @@ Register-ArgumentCompleter -CommandName Get-GitHubPermissionDefinition -Paramete param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) $null = $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters $pattern = switch (Get-GitHubConfig -Name CompletionMode) { 'Contains' { "*$wordToComplete*" } default { "$wordToComplete*" } } - [GitHubPermissionDefinition]::List.DisplayName | Sort-Object -Unique | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = [GitHubPermissionDefinition]::List.DisplayName | Sort-Object -Unique | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } @@ -20,7 +28,11 @@ Register-ArgumentCompleter -CommandName Get-GitHubPermissionDefinition -Paramete param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) $null = $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters $pattern = switch (Get-GitHubConfig -Name CompletionMode) { 'Contains' { "*$wordToComplete*" } default { "$wordToComplete*" } } - [GitHubPermissionDefinition]::List.Type | Sort-Object -Unique | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = [GitHubPermissionDefinition]::List.Type | Sort-Object -Unique | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } @@ -29,7 +41,11 @@ Register-ArgumentCompleter -CommandName Get-GitHubPermissionDefinition -Paramete param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) $null = $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters $pattern = switch (Get-GitHubConfig -Name CompletionMode) { 'Contains' { "*$wordToComplete*" } default { "$wordToComplete*" } } - [GitHubPermissionDefinition]::List.Scope | Sort-Object -Unique | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = [GitHubPermissionDefinition]::List.Scope | Sort-Object -Unique | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } diff --git a/src/functions/public/Repositories/Permissions/completers.ps1 b/src/functions/public/Repositories/Permissions/completers.ps1 index cdb1e0c2e..e266724bf 100644 --- a/src/functions/public/Repositories/Permissions/completers.ps1 +++ b/src/functions/public/Repositories/Permissions/completers.ps1 @@ -2,7 +2,11 @@ param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) $null = $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters $pattern = switch (Get-GitHubConfig -Name CompletionMode) { 'Contains' { "*$wordToComplete*" } default { "$wordToComplete*" } } - @('None', 'Pull', 'Triage', 'Push', 'Maintain', 'Admin', 'Read', 'Write') | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = @('None', 'Pull', 'Triage', 'Push', 'Maintain', 'Admin', 'Read', 'Write') | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } diff --git a/src/functions/public/Repositories/completers.ps1 b/src/functions/public/Repositories/completers.ps1 index 43ac6a7c7..124d98ae2 100644 --- a/src/functions/public/Repositories/completers.ps1 +++ b/src/functions/public/Repositories/completers.ps1 @@ -7,7 +7,11 @@ Verbose = $false Debug = $false } - Get-GitHubGitignore @params | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubGitignore @params | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } @@ -21,7 +25,11 @@ Register-ArgumentCompleter -CommandName New-GitHubRepository -ParameterName Lice Verbose = $false Debug = $false } - Get-GitHubLicense @params | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubLicense @params | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } @@ -30,7 +38,11 @@ Register-ArgumentCompleter -CommandName Get-GitHubRepository -ParameterName Addi param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) $null = $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters $pattern = switch (Get-GitHubConfig -Name CompletionMode) { 'Contains' { "*$wordToComplete*" } default { "$wordToComplete*" } } - [GitHubRepository].GetProperties().Name | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = [GitHubRepository].GetProperties().Name | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } @@ -39,7 +51,11 @@ Register-ArgumentCompleter -CommandName Get-GitHubRepository -ParameterName Prop param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) $null = $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters $pattern = switch (Get-GitHubConfig -Name CompletionMode) { 'Contains' { "*$wordToComplete*" } default { "$wordToComplete*" } } - [GitHubRepository].GetProperties().Name | Where-Object { $_ -like $pattern } | ForEach-Object { + $filteredOptions = [GitHubRepository].GetProperties().Name | Where-Object { $_ -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } @@ -54,7 +70,11 @@ Register-ArgumentCompleter -CommandName ($script:PSModuleInfo.FunctionsToExport) Verbose = $false Debug = $false } - Get-GitHubRepository @params | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubRepository @params | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } @@ -70,7 +90,11 @@ Register-ArgumentCompleter -CommandName ($script:PSModuleInfo.FunctionsToExport Verbose = $false Debug = $false } - Get-GitHubRepository @params | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubRepository @params | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } diff --git a/src/functions/public/Secrets/completers.ps1 b/src/functions/public/Secrets/completers.ps1 index 411ed8ace..ec923b24e 100644 --- a/src/functions/public/Secrets/completers.ps1 +++ b/src/functions/public/Secrets/completers.ps1 @@ -12,7 +12,11 @@ Debug = $false } $params | Remove-HashtableEntry -NullOrEmptyValues - Get-GitHubSecret @params | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubSecret @params | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } diff --git a/src/functions/public/Teams/completers.ps1 b/src/functions/public/Teams/completers.ps1 index 64d643909..d0c65e2a8 100644 --- a/src/functions/public/Teams/completers.ps1 +++ b/src/functions/public/Teams/completers.ps1 @@ -9,7 +9,11 @@ Verbose = $false Debug = $false } - Get-GitHubTeam @params | Where-Object { $_.Slug -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubTeam @params | Where-Object { $_.Slug -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Slug, $_.Slug, 'ParameterValue', $_.Slug) } } @@ -24,7 +28,11 @@ Register-ArgumentCompleter -CommandName ($script:PSModuleInfo.FunctionsToExport) Verbose = $false Debug = $false } - Get-GitHubTeam @params | Where-Object { $_.Slug -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubTeam @params | Where-Object { $_.Slug -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Slug, $_.Slug, 'ParameterValue', $_.Slug) } } diff --git a/src/functions/public/Variables/completers.ps1 b/src/functions/public/Variables/completers.ps1 index c897efa47..856e09ef4 100644 --- a/src/functions/public/Variables/completers.ps1 +++ b/src/functions/public/Variables/completers.ps1 @@ -12,7 +12,11 @@ Debug = $false } $params | Remove-HashtableEntry -NullOrEmptyValues - Get-GitHubVariable @params | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubVariable @params | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } diff --git a/src/functions/public/Workflows/completers.ps1 b/src/functions/public/Workflows/completers.ps1 index 29a8fb0e4..ca7c10323 100644 --- a/src/functions/public/Workflows/completers.ps1 +++ b/src/functions/public/Workflows/completers.ps1 @@ -11,7 +11,11 @@ Debug = $false } $params | Remove-HashtableEntry -NullOrEmptyValues - Get-GitHubWorkflow @params | Where-Object { $_.Name -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubWorkflow @params | Where-Object { $_.Name -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name) } } @@ -28,7 +32,11 @@ Register-ArgumentCompleter -CommandName ($script:PSModuleInfo.FunctionsToExport Debug = $false } $params | Remove-HashtableEntry -NullOrEmptyValues - Get-GitHubWorkflow @params | Where-Object { $_.ID -like $pattern } | ForEach-Object { + $filteredOptions = Get-GitHubWorkflow @params | Where-Object { $_.ID -like $pattern } + if (-not $filteredOptions) { + return $null + } + $filteredOptions | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_.ID, "$($_.Name) ($($_.ID))", 'ParameterValue', "$($_.Name) ($($_.ID))" ) } }