|
1 | | -This directory and it's subdirectories contain syntax changes that enable common programming scenarios in PowerShell and PipeScript. |
| 1 | +This directory and it's subdirectories contain Transpilers that transform parameter attributes. |
| 2 | + |
| 3 | +Parameter Transpilers do not need to take any values from the pipeline. |
| 4 | +They will be called by the Core PipeScript Transpiler ```PipeScript.ParameterAttribute```. |
| 5 | + |
| 6 | +When Transpiling a Parameter, the Transpiler should return one of two things. |
| 7 | + |
| 8 | +1. An empty ```[ScriptBlock]``` preceeded by attributes or help. This will replace the Transpiled attribute with a real one. |
| 9 | +2. A ```[Collections.IDictionary]``` can be used to send arguments directly back to ```Update-PipeScript```. |
| 10 | + |
| 11 | +Many parameter transpilers can also apply to a ```[Management.Automation.Language.VariableExpressionAst]```. |
| 12 | + |
| 13 | +When this is the case it is common for the transpiler to add a ```[ValidateScript]``` attribute to the variable. This will constraint the value of that variable. |
| 14 | + |
| 15 | +## List Of Parameter Transpilers |
2 | 16 |
|
3 | 17 | ~~~PipeScript{ |
4 | 18 | [PSCustomObject]@{ |
5 | 19 | Table = Get-Transpiler -TranspilerPath $pwd | |
6 | | - Select-Object DisplayName, Synopsis, @{ |
| 20 | + Select-Object DisplayName, @{ |
| 21 | + Name='Synopsis' |
| 22 | + Expression= { $_.Synopsis -replace '[\s\r\n]+$' } |
| 23 | + }, @{ |
7 | 24 | Name='Link' |
8 | 25 | Expression = { $_.Name } |
9 | 26 | } |
10 | | - }} |
| 27 | + } |
| 28 | +} |
11 | 29 | ~~~ |
12 | 30 |
|
13 | 31 |
|
14 | | -~~~PipeScript{ |
15 | | - @(foreach ($transpiler in Get-Transpiler -TranspilerPath $pwd) { |
16 | | - $examples = @($transpiler.Examples) |
17 | | - if (-not $examples) { continue } |
18 | | - for ($exampleNumber = 1; $exampleNumber -le $examples.Length; $exampleNumber++) { |
19 | | - @("## $($transpiler.DisplayName) Example $($exampleNumber)", |
20 | | - [Environment]::Newline, |
21 | | - "~~~PowerShell", |
22 | | - $examples[$exampleNumber - 1], |
23 | | - "~~~") -join [Environment]::Newline |
24 | | - } |
25 | | - }) -join ([Environment]::Newline * 2) |
26 | | -} |
27 | | -~~~ |
| 32 | + |
0 commit comments