Skip to content

Commit 144ace4

Browse files
Merge pull request #72 from PowershellFrameworkCollective/development
2.2.5.40
2 parents a1954b1 + 35b06d0 commit 144ace4

File tree

9 files changed

+383
-12
lines changed

9 files changed

+383
-12
lines changed

PSModuleDevelopment/PSModuleDevelopment.psd1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
RootModule = 'PSModuleDevelopment.psm1'
55

66
# Version number of this module.
7-
ModuleVersion = '2.2.5.37'
7+
ModuleVersion = '2.2.5.40'
88

99
# ID used to uniquely identify this module
1010
GUID = '37dd5fce-e7b5-4d57-ac37-832055ce49d6'
@@ -68,6 +68,7 @@
6868
'Get-PSMDAssembly',
6969
'Get-PSMDConstructor',
7070
'Get-PSMDHelpEx',
71+
'Get-PSMDMember',
7172
'Get-PSMDModuleDebug',
7273
'Get-PSMDTemplate',
7374
'Import-PSMDModuleDebug',
@@ -89,6 +90,7 @@
8990
'Set-PSMDCmdletBinding',
9091
'Set-PSMDModulePath',
9192
'Set-PSMDParameterHelp',
93+
'Show-PSMDSyntax',
9294
'Split-PSMDScriptFile'
9395
)
9496

PSModuleDevelopment/PSModuleDevelopment.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
$script:PSModuleRoot = $PSScriptRoot
2-
$script:PSModuleVersion = "2.2.5.37"
2+
$script:PSModuleVersion = "2.2.5.40"
33

44
$script:doDotSource = $false
55
if (Get-PSFConfigValue -FullName PSModuleDevelopment.Import.DoDotSource) { $script:doDotSource = $true }

PSModuleDevelopment/changelog.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
2-
## 2.2.5.37 ( October 20th, 2018)
2+
## 2.2.5.40 (December 17th, 2018)
3+
- New: Command Show-PSMDSyntax, used to show the parameter syntax with proper highlighting
4+
- New: Command Get-PSMDMember, used to show the members in a more organic and useful way
5+
- Fix: Template PSFProject build step was broken
6+
7+
## 2.2.5.37 (October 20th, 2018)
38
- Upd: Set-PSMDModulePath - add `-Module` parameter to persist the setting
49
- Upd: Set-PSMDModulePath - add `-Register` parameter for integrated persistence
510
- Upd: Set-PSMDEncoding - use `PSFEncoding` parameter class & tabcompletion
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
function Get-PSMDMember
2+
{
3+
<#
4+
.ForwardHelpTargetName Microsoft.PowerShell.Utility\Get-Member
5+
.ForwardHelpCategory Cmdlet
6+
#>
7+
[CmdletBinding(HelpUri = 'https://go.microsoft.com/fwlink/?LinkID=113322', RemotingCapability = 'None')]
8+
param (
9+
[Parameter(ValueFromPipeline = $true)]
10+
[psobject]
11+
$InputObject,
12+
13+
[Parameter(Position = 0)]
14+
[ValidateNotNullOrEmpty()]
15+
[string[]]
16+
$Name,
17+
18+
[Alias('Type')]
19+
[System.Management.Automation.PSMemberTypes]
20+
$MemberType,
21+
22+
[System.Management.Automation.PSMemberViewTypes]
23+
$View,
24+
25+
[string]
26+
$ArgumentType,
27+
28+
[string]
29+
$ReturnType,
30+
31+
[switch]
32+
$Static,
33+
34+
[switch]
35+
$Force
36+
)
37+
38+
begin
39+
{
40+
try
41+
{
42+
$outBuffer = $null
43+
if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer))
44+
{
45+
$PSBoundParameters['OutBuffer'] = 1
46+
}
47+
if ($ArgumentType) { $PSBoundParameters.Remove("ArgumentType") }
48+
if ($ReturnType) { $PSBoundParameters.Remove("ReturnType") }
49+
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Microsoft.PowerShell.Utility\Get-Member', [System.Management.Automation.CommandTypes]::Cmdlet)
50+
$scriptCmd = { & $wrappedCmd @PSBoundParameters }
51+
$steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin)
52+
$steppablePipeline.Begin($true)
53+
}
54+
catch
55+
{
56+
throw
57+
}
58+
59+
function Split-Member
60+
{
61+
[CmdletBinding()]
62+
param (
63+
[Parameter(ValueFromPipeline = $true)]
64+
[Microsoft.PowerShell.Commands.MemberDefinition]
65+
$Member
66+
)
67+
68+
process
69+
{
70+
if ($Member.MemberType -notlike "Method") { return $Member }
71+
72+
if ($Member.Definition -notlike "*), *") { return $Member }
73+
74+
foreach ($definition in $Member.Definition.Replace("), ", ")þþþ").Split("þþþ"))
75+
{
76+
if (-not $definition) { continue }
77+
New-Object Microsoft.PowerShell.Commands.MemberDefinition($Member.TypeName, $Member.Name, $Member.MemberType, $definition)
78+
}
79+
}
80+
}
81+
82+
}
83+
84+
process
85+
{
86+
try
87+
{
88+
$members = $steppablePipeline.Process($_) | Split-Member
89+
90+
if ($ArgumentType)
91+
{
92+
$tempMembers = @()
93+
foreach ($member in $members)
94+
{
95+
if ($member.MemberType -notlike "Method") { continue }
96+
97+
if (($member.Definition -split "\(",2)[1] -match $ArgumentType) { $tempMembers += $member }
98+
}
99+
$members = $tempMembers
100+
}
101+
102+
if ($ReturnType)
103+
{
104+
$members = $members | Where-Object Definition -match "^$ReturnType"
105+
}
106+
107+
$members
108+
}
109+
catch
110+
{
111+
throw
112+
}
113+
}
114+
115+
end
116+
{
117+
try
118+
{
119+
$steppablePipeline.End()
120+
}
121+
catch
122+
{
123+
throw
124+
}
125+
}
126+
}

0 commit comments

Comments
 (0)