Skip to content

Commit

Permalink
added DnsPlugin argument completer for issue #7
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbolger committed May 2, 2018
1 parent 18aaa50 commit 9291ba5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Posh-ACME/Posh-ACME.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,17 @@ $script:USER_AGENT = "Posh-ACME/0.1 PowerShell/$($PSVersionTable.PSVersion)"
$script:COMMON_HEADERS = @{'Accept-Language'='en-us,en;q=0.5'}
$script:CONTENT_TYPE = 'application/jose+json'

# setup the DnsPlugin argument completer
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/register-argumentcompleter?view=powershell-5.1
Register-ArgumentCompleter -CommandName 'New-PACertificate','Submit-ChallengeValidation' -ParameterName 'DnsPlugin' -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)

#$names = 'Infoblox','GCloud','Route53','Windows' | Sort-Object
$names = (Get-ChildItem -Path $PSScriptRoot\DnsPlugins\*.ps1 -Exclude '_Example.ps1').BaseName

$names | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
[Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}

Import-PAConfig

0 comments on commit 9291ba5

Please sign in to comment.