Skip to content

Commit cc7dae0

Browse files
author
James Brundage
committed
Completing merge
2 parents 234c96b + 010816d commit cc7dae0

File tree

7 files changed

+252
-0
lines changed

7 files changed

+252
-0
lines changed

Get-PipeScript.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function Get-PipeScript
1515
* Any module that includes -PipeScriptModuleName in it's tags.
1616
* The directory specified in -PipeScriptPath
1717
* Commands that meet the naming criteria
18+
* Commands that meet the naming criteria
1819
.Example
1920
Get-PipeScript
2021
#>
@@ -241,6 +242,7 @@ function Get-PipeScript
241242
}
242243
else {
243244
$ExecutionContext.SessionState.InvokeCommand.GetCommand($in, 'Alias,Function,ExternalScript,Application')
245+
$ExecutionContext.SessionState.InvokeCommand.GetCommand($in, 'Alias,Function,ExternalScript,Application')
244246
}
245247

246248
$extMethods = $extCmd.PSObject.Methods
@@ -856,6 +858,13 @@ function Get-PipeScript
856858
#endregion .CouldRun
857859

858860

861+
# Decorate our return (so that it can be uniquely extended)
862+
if (-not $PipeScriptTypeName) {
863+
$PipeScriptTypeName = 'Extension'
864+
}
865+
if ($extCmd.pstypenames -notcontains $PipeScriptTypeName) {
866+
$extCmd.pstypenames.insert(0,$PipeScriptTypeName)
867+
859868
# Decorate our return (so that it can be uniquely extended)
860869
if (-not $PipeScriptTypeName) {
861870
$PipeScriptTypeName = 'Extension'
@@ -900,6 +909,7 @@ function Get-PipeScript
900909
# Then, walk over each extension parameter.
901910
foreach ($kv in $extensionParams.GetEnumerator()) {
902911
# If the $CommandExtended had a built-in parameter, we cannot override it, so skip it.
912+
if ($commandExtended -and ($commandExtended -as [Management.Automation.CommandMetaData]).Parameters.$($kv.Key)) {
903913
if ($commandExtended -and ($commandExtended -as [Management.Automation.CommandMetaData]).Parameters.$($kv.Key)) {
904914
continue
905915
}
@@ -1047,6 +1057,7 @@ function Get-PipeScript
10471057
$script:PipeScriptsFromFiles = [Ordered]@{}
10481058
$script:PipeScriptsFileTimes = [Ordered]@{}
10491059
$script:PipeScripts =
1060+
@(@(
10501061
@(@(
10511062
#region Find PipeScript in Loaded Modules
10521063
foreach ($loadedModule in $loadedModules) { # Walk over all modules.

Get-Transpiler.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function Get-Transpiler
1515
* Any module that includes -TranspilerModuleName in it's tags.
1616
* The directory specified in -TranspilerPath
1717
* Commands that meet the naming criteria
18+
* Commands that meet the naming criteria
1819
.Example
1920
Get-Transpiler
2021
#>
@@ -241,6 +242,7 @@ function Get-Transpiler
241242
}
242243
else {
243244
$ExecutionContext.SessionState.InvokeCommand.GetCommand($in, 'Alias,Function,ExternalScript,Application')
245+
$ExecutionContext.SessionState.InvokeCommand.GetCommand($in, 'Alias,Function,ExternalScript,Application')
244246
}
245247

246248
$extMethods = $extCmd.PSObject.Methods
@@ -856,6 +858,13 @@ function Get-Transpiler
856858
#endregion .CouldRun
857859

858860

861+
# Decorate our return (so that it can be uniquely extended)
862+
if (-not $TranspilerTypeName) {
863+
$TranspilerTypeName = 'Extension'
864+
}
865+
if ($extCmd.pstypenames -notcontains $TranspilerTypeName) {
866+
$extCmd.pstypenames.insert(0,$TranspilerTypeName)
867+
859868
# Decorate our return (so that it can be uniquely extended)
860869
if (-not $TranspilerTypeName) {
861870
$TranspilerTypeName = 'Extension'
@@ -900,6 +909,7 @@ function Get-Transpiler
900909
# Then, walk over each extension parameter.
901910
foreach ($kv in $extensionParams.GetEnumerator()) {
902911
# If the $CommandExtended had a built-in parameter, we cannot override it, so skip it.
912+
if ($commandExtended -and ($commandExtended -as [Management.Automation.CommandMetaData]).Parameters.$($kv.Key)) {
903913
if ($commandExtended -and ($commandExtended -as [Management.Automation.CommandMetaData]).Parameters.$($kv.Key)) {
904914
continue
905915
}
@@ -1047,6 +1057,7 @@ function Get-Transpiler
10471057
$script:TranspilersFromFiles = [Ordered]@{}
10481058
$script:TranspilersFileTimes = [Ordered]@{}
10491059
$script:Transpilers =
1060+
@(@(
10501061
@(@(
10511062
#region Find Transpiler in Loaded Modules
10521063
foreach ($loadedModule in $loadedModules) { # Walk over all modules.

docs/Inherit.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@ Inherit
44

55

66

7+
8+
9+
10+
711
### Synopsis
812
Inherits a Command
913

1014

1115

16+
17+
1218
---
1319

1420

21+
22+
1523
### Description
1624

1725
Inherits a given command.
@@ -36,9 +44,13 @@ One interesting example is overriding an application
3644

3745

3846

47+
48+
3949
---
4050

4151

52+
53+
4254
### Examples
4355
#### EXAMPLE 1
4456
```PowerShell
@@ -77,9 +89,13 @@ Invoke-PipeScript {
7789

7890

7991

92+
93+
8094
---
8195

8296

97+
98+
8399
### Parameters
84100
#### **Command**
85101

@@ -103,6 +119,9 @@ It will also define a variable within a dynamicParam {} block that contains the
103119

104120

105121

122+
|Type |Required|Position|PipelineInput|
123+
|----------|--------|--------|-------------|
124+
|`[Switch]`|false |named |false |
106125
|Type |Required|Position|PipelineInput|
107126
|----------|--------|--------|-------------|
108127
|`[Switch]`|false |named |false |
@@ -118,6 +137,9 @@ If provided, will set an alias on the function to replace the original command.
118137

119138

120139

140+
|Type |Required|Position|PipelineInput|Aliases |
141+
|----------|--------|--------|-------------|--------|
142+
|`[Switch]`|false |named |false |Overload|
121143
|Type |Required|Position|PipelineInput|Aliases |
122144
|----------|--------|--------|-------------|--------|
123145
|`[Switch]`|false |named |false |Overload|
@@ -134,6 +156,9 @@ This will use dynamic parameters instead of static parameters, and will use a pr
134156

135157

136158

159+
|Type |Required|Position|PipelineInput|
160+
|----------|--------|--------|-------------|
161+
|`[Switch]`|false |named |false |
137162
|Type |Required|Position|PipelineInput|
138163
|----------|--------|--------|-------------|
139164
|`[Switch]`|false |named |false |
@@ -150,6 +175,9 @@ This is implied by -Dynamic.
150175

151176

152177

178+
|Type |Required|Position|PipelineInput|
179+
|----------|--------|--------|-------------|
180+
|`[Switch]`|false |named |false |
153181
|Type |Required|Position|PipelineInput|
154182
|----------|--------|--------|-------------|
155183
|`[Switch]`|false |named |false |
@@ -167,6 +195,9 @@ If the -CommandType includes aliases, and another command is also found, that co
167195

168196

169197

198+
|Type |Required|Position|PipelineInput|Aliases |
199+
|------------|--------|--------|-------------|------------|
200+
|`[String[]]`|false |named |false |CommandTypes|
170201
|Type |Required|Position|PipelineInput|Aliases |
171202
|------------|--------|--------|-------------|------------|
172203
|`[String[]]`|false |named |false |CommandTypes|
@@ -197,6 +228,9 @@ Valid Values:
197228

198229

199230

231+
|Type |Required|Position|PipelineInput|Aliases |
232+
|------------|--------|--------|-------------|------------------------------------------------------|
233+
|`[String[]]`|false |named |false |SkipBlockType<br/>SkipBlockTypes<br/>ExcludeBlockTypes|
200234
|Type |Required|Position|PipelineInput|Aliases |
201235
|------------|--------|--------|-------------|------------------------------------------------------|
202236
|`[String[]]`|false |named |false |SkipBlockType<br/>SkipBlockTypes<br/>ExcludeBlockTypes|
@@ -226,6 +260,9 @@ Valid Values:
226260

227261

228262

263+
|Type |Required|Position|PipelineInput|Aliases |
264+
|------------|--------|--------|-------------|----------------------------------------------|
265+
|`[String[]]`|false |named |false |BlockType<br/>BlockTypes<br/>IncludeBlockTypes|
229266
|Type |Required|Position|PipelineInput|Aliases |
230267
|------------|--------|--------|-------------|----------------------------------------------|
231268
|`[String[]]`|false |named |false |BlockType<br/>BlockTypes<br/>IncludeBlockTypes|
@@ -242,6 +279,9 @@ If -IncludeParameter is provided without -ExcludeParameter, all other parameters
242279

243280

244281

282+
|Type |Required|Position|PipelineInput|
283+
|------------|--------|--------|-------------|
284+
|`[String[]]`|false |named |false |
245285
|Type |Required|Position|PipelineInput|
246286
|------------|--------|--------|-------------|
247287
|`[String[]]`|false |named |false |
@@ -258,6 +298,9 @@ Excluded parameters with default values will declare the default value at the be
258298

259299

260300

301+
|Type |Required|Position|PipelineInput|
302+
|------------|--------|--------|-------------|
303+
|`[String[]]`|false |named |false |
261304
|Type |Required|Position|PipelineInput|
262305
|------------|--------|--------|-------------|
263306
|`[String[]]`|false |named |false |
@@ -269,6 +312,11 @@ Excluded parameters with default values will declare the default value at the be
269312

270313

271314

315+
316+
317+
|Type |Required|Position|PipelineInput |
318+
|---------------|--------|--------|--------------|
319+
|`[ScriptBlock]`|false |named |true (ByValue)|
272320
|Type |Required|Position|PipelineInput |
273321
|---------------|--------|--------|--------------|
274322
|`[ScriptBlock]`|false |named |true (ByValue)|
@@ -280,6 +328,8 @@ Excluded parameters with default values will declare the default value at the be
280328
---
281329

282330

331+
332+
283333
### Syntax
284334
```PowerShell
285335
Inherit [-Command] <String> [-Abstract] [-Override] [-Dynamic] [-Proxy] [-CommandType <String[]>] [-ExcludeBlockType <String[]>] [-IncludeBlockType <String[]>] [-IncludeParameter <String[]>] [-ExcludeParameter <String[]>] [-ScriptBlock <ScriptBlock>] [<CommonParameters>]

docs/Invoke-PipeScript.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@ Invoke-PipeScript
44

55

66

7+
8+
9+
10+
711
### Synopsis
812
Invokes PipeScript or PowerShell ScriptBlocks, commands, and syntax.
913

1014

1115

16+
17+
1218
---
1319

1420

21+
22+
1523
### Description
1624

1725
Runs PipeScript.
@@ -32,19 +40,27 @@ Invoke-PipeScript can also use a number of Abstract Syntax Tree elements as comm
3240

3341

3442

43+
44+
3545
---
3646

3747

48+
49+
3850
### Related Links
3951
* [Update-PipeScript](Update-PipeScript.md)
4052

4153

4254

4355

4456

57+
58+
4559
---
4660

4761

62+
63+
4864
### Parameters
4965
#### **InputObject**
5066

@@ -56,6 +72,9 @@ If no -Command is provided and -InputObject is a [ScriptBlock]
5672

5773

5874

75+
|Type |Required|Position|PipelineInput |
76+
|------------|--------|--------|--------------|
77+
|`[PSObject]`|false |named |true (ByValue)|
5978
|Type |Required|Position|PipelineInput |
6079
|------------|--------|--------|--------------|
6180
|`[PSObject]`|false |named |true (ByValue)|
@@ -71,6 +90,9 @@ The Command that will be run.
7190

7291

7392

93+
|Type |Required|Position|PipelineInput|Aliases |
94+
|------------|--------|--------|-------------|--------------------------------------------------------------------------------------|
95+
|`[PSObject]`|false |1 |false |ScriptBlock<br/>CommandName<br/>CommandInfo<br/>AttributeSyntaxTree<br/>TypeConstraint|
7496
|Type |Required|Position|PipelineInput|Aliases |
7597
|------------|--------|--------|-------------|--------------------------------------------------------------------------------------|
7698
|`[PSObject]`|false |1 |false |ScriptBlock<br/>CommandName<br/>CommandInfo<br/>AttributeSyntaxTree<br/>TypeConstraint|
@@ -86,6 +108,9 @@ A collection of named parameters. These will be directly passed to the underlyi
86108

87109

88110

111+
|Type |Required|Position|PipelineInput|Aliases |
112+
|---------------|--------|--------|-------------|----------|
113+
|`[IDictionary]`|false |named |false |Parameters|
89114
|Type |Required|Position|PipelineInput|Aliases |
90115
|---------------|--------|--------|-------------|----------|
91116
|`[IDictionary]`|false |named |false |Parameters|
@@ -135,6 +160,11 @@ If this is set, will make ScriptBlockAst values will be run within data language
135160

136161

137162

163+
164+
165+
|Type |Required|Position|PipelineInput|
166+
|----------|--------|--------|-------------|
167+
|`[Switch]`|false |named |false |
138168
|Type |Required|Position|PipelineInput|
139169
|----------|--------|--------|-------------|
140170
|`[Switch]`|false |named |false |
@@ -146,6 +176,8 @@ If this is set, will make ScriptBlockAst values will be run within data language
146176
---
147177

148178

179+
180+
149181
### Syntax
150182
```PowerShell
151183
Invoke-PipeScript [-InputObject <PSObject>] [[-Command] <PSObject>] [-Parameter <IDictionary>] [-ArgumentList <PSObject[]>] [-OutputPath <String>] [-SafeScriptBlockAttributeEvaluation] [<CommonParameters>]

0 commit comments

Comments
 (0)