Created
November 28, 2016 15:29
-
-
Save DexterPOSH/d62aa77ed0c4b81d901c17272451ef10 to your computer and use it in GitHub Desktop.
Try to create tab completion for the PSDeploy DSL.
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 PSDeployCompletion | |
{ | |
param( $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) | |
$CommandTree = Get-CompletionPrivateData -Key PSDeployCompletionCommandTree | |
if ($null -eq $CommandTree) { | |
$CommandTree = & { | |
New-CommandTree -Completion FromSource -ToolTip 'Source' -Argument | |
New-CommandTree -Completion To -ToolTip 'Destination' -Argument | |
New-CommandTree -Completion Tagged -ToolTip 'Tags to use for the deployment' -Argument | |
New-CommandTree -Completion WithOptions -ToolTip 'options for the deployment' -SubCommands { | |
New-CommandTree -Completion Test -tooltip 'test' | |
} | |
} | |
Set-CompletionPrivateData -Key PSDeployCompletionCommandTree -Value $commandTree | |
} | |
Get-CommandTreeCompletion $wordToComplete $commandAst $commandTree | |
} | |
Register-ArgumentCompleter ` | |
-Command 'By' ` | |
-ParameterName 'ScriptBlock' ` | |
-Description 'Complete arguments to a Deployment' ` | |
-ScriptBlock $function:PSDeployCompletion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Below is an example of the PSDeploy DSL