|
| 1 | +Requires |
| 2 | +-------- |
| 3 | +### Synopsis |
| 4 | +requires one or more modules, variables, or types. |
| 5 | + |
| 6 | +--- |
| 7 | +### Description |
| 8 | + |
| 9 | +Requires will require on or more modules, variables, or types to exist. |
| 10 | + |
| 11 | +--- |
| 12 | +### Examples |
| 13 | +#### EXAMPLE 1 |
| 14 | +```PowerShell |
| 15 | +requires latest pipescript # will require the latest version of pipescript |
| 16 | +``` |
| 17 | + |
| 18 | +#### EXAMPLE 2 |
| 19 | +```PowerShell |
| 20 | +requires variable $pid $sid # will error, because there is no $sid |
| 21 | +``` |
| 22 | + |
| 23 | +--- |
| 24 | +### Parameters |
| 25 | +#### **Module** |
| 26 | + |
| 27 | +One or more required modules. |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +> **Type**: ```[Object]``` |
| 32 | +
|
| 33 | +> **Required**: false |
| 34 | +
|
| 35 | +> **Position**: named |
| 36 | +
|
| 37 | +> **PipelineInput**:true (ByPropertyName) |
| 38 | +
|
| 39 | + |
| 40 | + |
| 41 | +--- |
| 42 | +#### **Latest** |
| 43 | + |
| 44 | +If set, will require the latest version of a module. |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +> **Type**: ```[Switch]``` |
| 49 | +
|
| 50 | +> **Required**: false |
| 51 | +
|
| 52 | +> **Position**: named |
| 53 | +
|
| 54 | +> **PipelineInput**:true (ByPropertyName) |
| 55 | +
|
| 56 | + |
| 57 | + |
| 58 | +--- |
| 59 | +#### **ModuleLoader** |
| 60 | + |
| 61 | +A ModuleLoader script can be used to dynamically load unresolved modules. |
| 62 | +This script will be passed the unloaded module as an argument, and should return a module. |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +> **Type**: ```[ScriptBlock]``` |
| 67 | +
|
| 68 | +> **Required**: false |
| 69 | +
|
| 70 | +> **Position**: named |
| 71 | +
|
| 72 | +> **PipelineInput**:true (ByPropertyName) |
| 73 | +
|
| 74 | + |
| 75 | + |
| 76 | +--- |
| 77 | +#### **Type** |
| 78 | + |
| 79 | +One or more required types. |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | +> **Type**: ```[Object]``` |
| 84 | +
|
| 85 | +> **Required**: false |
| 86 | +
|
| 87 | +> **Position**: named |
| 88 | +
|
| 89 | +> **PipelineInput**:true (ByPropertyName) |
| 90 | +
|
| 91 | + |
| 92 | + |
| 93 | +--- |
| 94 | +#### **TypeLoader** |
| 95 | + |
| 96 | +A TypeLoader script can be used to dynamically load unresolved types. |
| 97 | +This script will be passed the unloaded type as an argument. |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | +> **Type**: ```[ScriptBlock]``` |
| 102 | +
|
| 103 | +> **Required**: false |
| 104 | +
|
| 105 | +> **Position**: named |
| 106 | +
|
| 107 | +> **PipelineInput**:true (ByPropertyName) |
| 108 | +
|
| 109 | + |
| 110 | + |
| 111 | +--- |
| 112 | +#### **Variables** |
| 113 | + |
| 114 | +One or more required variables. |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | +> **Type**: ```[Object]``` |
| 119 | +
|
| 120 | +> **Required**: false |
| 121 | +
|
| 122 | +> **Position**: named |
| 123 | +
|
| 124 | +> **PipelineInput**:true (ByPropertyName) |
| 125 | +
|
| 126 | + |
| 127 | + |
| 128 | +--- |
| 129 | +#### **VariableLoader** |
| 130 | + |
| 131 | +A VariableLoader script can be used to dynamically load unresolved variable. |
| 132 | +This script will be passed the unloaded variable as an argument. |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | +> **Type**: ```[ScriptBlock]``` |
| 137 | +
|
| 138 | +> **Required**: false |
| 139 | +
|
| 140 | +> **Position**: named |
| 141 | +
|
| 142 | +> **PipelineInput**:true (ByPropertyName) |
| 143 | +
|
| 144 | + |
| 145 | + |
| 146 | +--- |
| 147 | +#### **CommandAst** |
| 148 | + |
| 149 | +The Command AST. This will be provided when using the transpiler as a keyword. |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | +> **Type**: ```[CommandAst]``` |
| 154 | +
|
| 155 | +> **Required**: true |
| 156 | +
|
| 157 | +> **Position**: named |
| 158 | +
|
| 159 | +> **PipelineInput**:true (ByValue) |
| 160 | +
|
| 161 | + |
| 162 | + |
| 163 | +--- |
| 164 | +#### **ScriptBlock** |
| 165 | + |
| 166 | +The ScriptBlock. This will be provided when using the transpiler as an attribute. |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | +> **Type**: ```[ScriptBlock]``` |
| 171 | +
|
| 172 | +> **Required**: true |
| 173 | +
|
| 174 | +> **Position**: named |
| 175 | +
|
| 176 | +> **PipelineInput**:true (ByValue) |
| 177 | +
|
| 178 | + |
| 179 | + |
| 180 | +--- |
| 181 | +### Syntax |
| 182 | +```PowerShell |
| 183 | +Requires [-Module <Object>] [-Latest] [-ModuleLoader <ScriptBlock>] [-Type <Object>] [-TypeLoader <ScriptBlock>] [-Variables <Object>] [-VariableLoader <ScriptBlock>] -CommandAst <CommandAst> [<CommonParameters>] |
| 184 | +``` |
| 185 | +```PowerShell |
| 186 | +Requires [-Module <Object>] [-Latest] [-ModuleLoader <ScriptBlock>] [-Type <Object>] [-TypeLoader <ScriptBlock>] [-Variables <Object>] [-VariableLoader <ScriptBlock>] -ScriptBlock <ScriptBlock> [<CommonParameters>] |
| 187 | +``` |
| 188 | +--- |
| 189 | + |
0 commit comments