Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/completers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand All @@ -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)
}
}
6 changes: 5 additions & 1 deletion src/functions/public/Auth/Context/completers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
36 changes: 30 additions & 6 deletions src/functions/public/Config/completers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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', $_ )
}
}
Expand All @@ -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', $_)
}
}
Expand All @@ -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)
}
}
Expand Down
12 changes: 10 additions & 2 deletions src/functions/public/Environments/completers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
6 changes: 5 additions & 1 deletion src/functions/public/Gitignore/completers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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', $_)
}
}
6 changes: 5 additions & 1 deletion src/functions/public/License/completers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
18 changes: 15 additions & 3 deletions src/functions/public/Organization/completers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand All @@ -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)
}
}
24 changes: 20 additions & 4 deletions src/functions/public/Permission/completers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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', $_)
}
}
Expand All @@ -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', $_)
}
}
Expand All @@ -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', $_)
}
}
Expand All @@ -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', $_)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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', $_)
}
}
36 changes: 30 additions & 6 deletions src/functions/public/Repositories/completers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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', $_)
}
}
Expand All @@ -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)
}
}
Expand All @@ -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', $_)
}
}
Expand All @@ -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', $_)
}
}
Expand All @@ -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)
}
}
Expand All @@ -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)
}
}
6 changes: 5 additions & 1 deletion src/functions/public/Secrets/completers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
12 changes: 10 additions & 2 deletions src/functions/public/Teams/completers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Loading
Loading