Skip to content

Commit

Permalink
Adding Posh.ExtensionCollection get_All (Fixes #128)
Browse files Browse the repository at this point in the history
  • Loading branch information
StartAutomating authored and StartAutomating committed Aug 10, 2023
1 parent 981b825 commit 869ed9f
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Posh.types.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,44 @@ Get-History -Id $historyIDS
<Type>
<Name>Posh.ExtensionCollection</Name>
<Members>
<ScriptProperty>
<Name>All</Name>
<GetScriptBlock>
&lt;#
.SYNOPSIS
Gets all items in an extension collection.
.DESCRIPTION
Gets all items in a collection of extended commands.
#&gt;
if (-not $this.'.Cache') {
if (-not $this.'.Module') { return @() }

$findExtensionArgs = @($this.'.Module') + @($this.'.Path')
$allExtensionsFound =
@(:nextExtension
foreach ($foundExtension in
$posh.Commands.FindExtensions.Invoke($findExtensionArgs)
)
{
if ($this.'.CommandType') {
foreach ($typename in $this.'.CommandType') {
if ($foundExtension.pstypenames -contains $typename) {
$foundExtension
continue nextExtension
}
}
} else {
$foundExtension
}
}
)
$this |
Add-Member NoteProperty '.Cache' $allExtensionsFound -Force
}

return $this.'.Cache'
</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>CommandType</Name>
<GetScriptBlock>
Expand Down

0 comments on commit 869ed9f

Please sign in to comment.