Created
October 31, 2016 23:09
-
-
Save bielawb/32aa1edd699ddba64c48dc48f4ae65db to your computer and use it in GitHub Desktop.
Module that uses WMF5 completion for skeleton New-JiraIssue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-LoginCompletion { | |
param( | |
[string]$commandName, | |
[string]$parameterName, | |
[string]$wordToComplete, | |
[System.Management.Automation.Language.CommandAst]$commandAst, | |
[System.Collections.IDictionary]$fakeBoundParameters | |
) | |
([ADSISearcher]"(&(objectClass=user)(sAMAccountName=$wordToComplete*))").FindAll() | | |
ForEach-Object { | |
$user = $_.GetDirectoryEntry() | |
[System.Management.Automation.CompletionResult]::new( | |
$user.sAMACcountNAme, | |
$user.sAMACcountNAme, | |
[System.Management.Automation.CompletionResultType]::ParameterValue, | |
"User $($user.Name)" | |
) | |
} | |
} | |
function New-JiraIssue { | |
param ( | |
[ArgumentCompleter({Get-LoginCompletion @args})] | |
[String]$Reporter, | |
[ArgumentCompleter({Get-LoginCompletion @args})] | |
[String]$Assignee | |
) | |
Write-Warning "Reporter: $Reporter, Assignee: $Assignee" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment