Created
February 8, 2018 01:45
-
-
Save NoCheroot/d6875b95660d3cc79cbf2326b9e772cc to your computer and use it in GitHub Desktop.
Powershell CompleteInput example
This file contains hidden or 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
| $cmd = "ConvertTo-Json -" | |
| $ret = [System.Management.Automation.CommandCompletion]::MapStringInputToParsedInput($cmd, $cmd.Length) | |
| $candidates = [System.Management.Automation.CommandCompletion]::CompleteInput( | |
| $ret.Item1, | |
| $ret.Item2, | |
| $ret.Item3, | |
| $null, | |
| [System.Management.Automation.PowerShell]::Create() | |
| ).CompletionMatches | |
| $candidates | ForEach-Object { | |
| [pscustomobject]@{ | |
| CompletionText = $_.CompletionText | |
| ResultType = $_.ResultType.ToString() | |
| ToolTip = $_.ToolTip | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment