|
| 1 | + |
| 2 | +Transpilers/ProxyCommand.psx.ps1 |
| 3 | +-------------------------------- |
| 4 | +### Synopsis |
| 5 | +Creates Proxy Commands |
| 6 | + |
| 7 | +--- |
| 8 | +### Description |
| 9 | + |
| 10 | +Generates a Proxy Command for an underlying PowerShell or PipeScript command. |
| 11 | + |
| 12 | +--- |
| 13 | +### Examples |
| 14 | +#### EXAMPLE 1 |
| 15 | +```PowerShell |
| 16 | +.\ProxyCommand.psx.ps1 -CommandName Get-Process |
| 17 | +``` |
| 18 | + |
| 19 | +#### EXAMPLE 2 |
| 20 | +```PowerShell |
| 21 | +{ |
| 22 | + function [ProxyCommand<'Get-Process'>]GetProcessProxy {} |
| 23 | +} | .>PipeScript |
| 24 | +``` |
| 25 | + |
| 26 | +#### EXAMPLE 3 |
| 27 | +```PowerShell |
| 28 | +ProxyCommand -CommandName Get-Process -RemoveParameter * |
| 29 | +``` |
| 30 | + |
| 31 | +#### EXAMPLE 4 |
| 32 | +```PowerShell |
| 33 | +Invoke-PipeScript -ScriptBlock {[ProxyCommand('Get-Process')]param()} |
| 34 | +``` |
| 35 | + |
| 36 | +#### EXAMPLE 5 |
| 37 | +```PowerShell |
| 38 | +Invoke-PipeScript -ScriptBlock { |
| 39 | + [ProxyCommand('Get-Process', |
| 40 | + RemoveParameter='*', |
| 41 | + DefaultParameter={ |
| 42 | + @{id='$pid'} |
| 43 | + })] |
| 44 | + param() |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +#### EXAMPLE 6 |
| 49 | +```PowerShell |
| 50 | +{ |
| 51 | + function Get-MyProcess { |
| 52 | + [ProxyCommand('Get-Process', |
| 53 | + RemoveParameter='*', |
| 54 | + DefaultParameter={ |
| 55 | + @{id='$pid'} |
| 56 | + })] |
| 57 | + param() |
| 58 | + } |
| 59 | +} | .>PipeScript |
| 60 | +``` |
| 61 | + |
| 62 | +--- |
| 63 | +### Parameters |
| 64 | +#### **ScriptBlock** |
| 65 | + |
| 66 | +The ScriptBlock that will become a proxy command. This should be empty, since it is ignored. |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +|Type |Requried|Postion|PipelineInput | |
| 71 | +|-------------------|--------|-------|--------------| |
| 72 | +|```[ScriptBlock]```|false |named |true (ByValue)| |
| 73 | +--- |
| 74 | +#### **CommandName** |
| 75 | + |
| 76 | +The name of the command being proxied. |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +|Type |Requried|Postion|PipelineInput| |
| 81 | +|--------------|--------|-------|-------------| |
| 82 | +|```[String]```|true |1 |false | |
| 83 | +--- |
| 84 | +#### **RemoveParameter** |
| 85 | + |
| 86 | +If provided, will remove any number of parameters from the proxy command. |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +|Type |Requried|Postion|PipelineInput| |
| 91 | +|----------------|--------|-------|-------------| |
| 92 | +|```[String[]]```|false |named |false | |
| 93 | +--- |
| 94 | +#### **DefaultParameter** |
| 95 | + |
| 96 | +Any default parameters for the ProxyCommand. |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | +|Type |Requried|Postion|PipelineInput| |
| 101 | +|-------------------|--------|-------|-------------| |
| 102 | +|```[IDictionary]```|false |named |false | |
| 103 | +--- |
| 104 | +### Syntax |
| 105 | +```PowerShell |
| 106 | +Transpilers/ProxyCommand.psx.ps1 [-ScriptBlock <ScriptBlock>] [-CommandName] <String> [-RemoveParameter <String[]>] [-DefaultParameter <IDictionary>] [<CommonParameters>] |
| 107 | +``` |
| 108 | +--- |
| 109 | + |
| 110 | + |
0 commit comments