File tree Expand file tree Collapse file tree 2 files changed +43
-11
lines changed Expand file tree Collapse file tree 2 files changed +43
-11
lines changed Original file line number Diff line number Diff line change @@ -2607,7 +2607,6 @@ function ConvertPsObjectsToMamlModel
2607
2607
2608
2608
$ParameterObject.DefaultValue = $HelpEntry.defaultValue | normalizeFirstLatter
2609
2609
$ParameterObject.VariableLength = $HelpEntry.variableLength -eq ' True'
2610
- $ParameterObject.Globbing = $HelpEntry.globbing -eq ' True'
2611
2610
$ParameterObject.Position = $HelpEntry.position | normalizeFirstLatter
2612
2611
if ($HelpEntry.description )
2613
2612
{
@@ -2662,27 +2661,35 @@ function ConvertPsObjectsToMamlModel
2662
2661
}
2663
2662
}
2664
2663
2665
- if ($ExcludeDontShow )
2664
+ $hasDontShow = $false
2665
+ $hasSupportsWildsCards = $false
2666
+
2667
+ foreach ($Attribute in $Parameter.Attributes )
2666
2668
{
2667
- $hasDontShow = $false
2668
- foreach ($Attribute in $Parameter.Attributes )
2669
+ if ($ExcludeDontShow )
2669
2670
{
2670
2671
if ($Attribute.TypeId.ToString () -eq ' System.Management.Automation.ParameterAttribute' -and $Attribute.DontShow )
2671
2672
{
2672
2673
$hasDontShow = $true
2673
2674
}
2674
2675
}
2675
2676
2676
- if ($hasDontShow )
2677
+ if ($Attribute .TypeId.ToString () -eq ' System.Management.Automation.SupportsWildcardsAttribute ' )
2677
2678
{
2678
- continue
2679
+ $hasSupportsWildsCards = $true
2679
2680
}
2680
2681
}
2681
2682
2683
+ if ($hasDontShow )
2684
+ {
2685
+ continue
2686
+ }
2687
+
2682
2688
$ParameterObject = New-Object - TypeName Markdown.MAML.Model.MAML.MamlParameter
2683
2689
$ParameterObject.Name = $Parameter.Name
2684
2690
$ParameterObject.Required = $Parameter.IsMandatory
2685
2691
$ParameterObject.PipelineInput = getPipelineValue $Parameter
2692
+ $ParameterObject.Globbing = $hasSupportsWildsCards
2686
2693
# the ParameterType could be just a string in case of remoting
2687
2694
# or a TypeInfo object, in the regular case
2688
2695
if ($Session ) {
Original file line number Diff line number Diff line change @@ -146,14 +146,14 @@ Describe 'New-MarkdownHelp' {
146
146
}
147
147
}
148
148
149
- Context ' from external script' {
149
+ Context ' from external script' {
150
150
It ' fully qualified path' {
151
151
$SeedData = @"
152
- <#
152
+ <#
153
153
.SYNOPSIS
154
154
Synopsis Here.
155
155
156
- .DESCRIPTION
156
+ .DESCRIPTION
157
157
Description Here.
158
158
159
159
.INPUTS
@@ -175,11 +175,11 @@ Write-Host 'Hello World!'
175
175
}
176
176
It ' relative path' {
177
177
$SeedData = @"
178
- <#
178
+ <#
179
179
.SYNOPSIS
180
180
Synopsis Here.
181
181
182
- .DESCRIPTION
182
+ .DESCRIPTION
183
183
Description Here.
184
184
185
185
.INPUTS
@@ -680,6 +680,31 @@ Get-Alpha [-WhatIf] [[-CCC] <String>] [[-ddd] <Int32>] [<CommonParameters>]
680
680
($set2 | Measure-Object ).Count | Should Be 1
681
681
}
682
682
}
683
+
684
+ Context ' SupportsWildCards attribute tests' {
685
+ BeforeAll {
686
+
687
+ function global :Test-WildCardsAttribute {
688
+ param (
689
+ [Parameter ()]
690
+ [SupportsWildcards ()]
691
+ [string ] $Name ,
692
+
693
+ [Parameter ()]
694
+ [string ] $NameNoWildCard
695
+ )
696
+ }
697
+
698
+ $file = New-MarkdownHelp - Command ' Test-WildCardsAttribute' - OutputFolder " $TestDrive \NewMarkDownHelp"
699
+ $maml = $file | New-ExternalHelp - OutputPath " $TestDrive \NewMarkDownHelp"
700
+ $help = Get-HelpPreview - Path $maml
701
+ }
702
+
703
+ It ' sets accepts wildcards property on parameters as expected' {
704
+ $help.parameters.parameter | Where-Object { $_.Name -eq ' Name' } | ForEach-Object { $_.globbing -eq ' true' }
705
+ $help.parameters.parameter | Where-Object { $_.Name -eq ' NameNoWildCard' } | ForEach-Object { $_.globbing -eq ' false' }
706
+ }
707
+ }
683
708
}
684
709
}
685
710
You can’t perform that action at this time.
0 commit comments