|
1 | | -#region Piecemeal [ 0.3.2 ] : Easy Extensible Plugins for PowerShell |
| 1 | +#region Piecemeal [ 0.3.3 ] : Easy Extensible Plugins for PowerShell |
2 | 2 | # Install-Module Piecemeal -Scope CurrentUser |
3 | 3 | # Import-Module Piecemeal -Force |
4 | 4 | # Install-Piecemeal -ExtensionNoun 'PipeScript' -ExtensionPattern '\.psx\.ps1{0,1}$','\.ps1{0,1}\.(?<ext>[^.]+$)','\.ps1{0,1}$' -ExtensionTypeName 'PipeScript' -OutputPath '.\Get-PipeScript.ps1' |
@@ -153,20 +153,7 @@ function Get-PipeScript |
153 | 153 |
|
154 | 154 | # If set, will output the help for the extensions |
155 | 155 | [switch] |
156 | | - $Help, |
157 | | - |
158 | | - # If set, will get help about one or more parameters of an extension |
159 | | - [string[]] |
160 | | - $ParameterHelp, |
161 | | - |
162 | | - # If set, will get help examples |
163 | | - [Alias('Examples')] |
164 | | - [switch] |
165 | | - $Example, |
166 | | - |
167 | | - # If set, will output the full help for the extensions |
168 | | - [switch] |
169 | | - $FullHelp |
| 156 | + $Help |
170 | 157 | ) |
171 | 158 |
|
172 | 159 | begin { |
@@ -292,15 +279,21 @@ function Get-PipeScript |
292 | 279 |
|
293 | 280 | $extCmd.PSObject.Methods.Add([psscriptmethod]::New('GetHelpField', { |
294 | 281 | param([Parameter(Mandatory)]$Field) |
295 | | - foreach ($block in $this.BlockComments) { |
| 282 | + $fieldNames = 'synopsis','description','link','example','inputs', 'outputs', 'parameter', 'notes' |
| 283 | + foreach ($block in $this.BlockComments) { |
296 | 284 | foreach ($match in [Regex]::new(" |
297 | 285 | \.(?<Field>$Field) # Field Start |
298 | 286 | [\s-[\r\n]]{0,} # Optional Whitespace |
299 | 287 | [\r\n]+ # newline |
300 | | - (?<Content>(.|\s)+?(?=(\.\w+|\#\>))) # Anything until the next .\field or end of the comment block |
| 288 | + (?<Content>(?:.|\s)+?(?= |
| 289 | + ( |
| 290 | + [\r\n]{0,}\s{0,}\.(?>$($fieldNames -join '|'))| |
| 291 | + \#\>| |
| 292 | + \z |
| 293 | + ))) # Anything until the next .field or end of the comment block |
301 | 294 | ", 'IgnoreCase,IgnorePatternWhitespace', [Timespan]::FromSeconds(1)).Matches( |
302 | 295 | $block.Value |
303 | | - )) { |
| 296 | + )) { |
304 | 297 | $match.Groups["Content"].Value -replace '[\s\r\n]+$' |
305 | 298 | } |
306 | 299 | } |
@@ -813,18 +806,9 @@ function Get-PipeScript |
813 | 806 | } |
814 | 807 | return |
815 | 808 | } |
816 | | - elseif ($IsValid -and ($Help -or $FullHelp -or $Example -or $ParameterHelp)) { |
817 | | - $getHelpSplat = @{} |
818 | | - if ($FullHelp) { |
819 | | - $getHelpSplat["Full"] = $true |
820 | | - } |
821 | | - if ($Example) { |
822 | | - $getHelpSplat["Example"] = $true |
823 | | - } |
824 | | - if ($ParameterHelp) { |
825 | | - $getHelpSplat["ParameterHelp"] = $ParameterHelp |
826 | | - } |
827 | | - |
| 809 | + elseif ($IsValid -and $Help) { |
| 810 | + $getHelpSplat = @{Full=$true} |
| 811 | + |
828 | 812 | if ($extCmd -is [Management.Automation.ExternalScriptInfo]) { |
829 | 813 | Get-Help $extCmd.Source @getHelpSplat |
830 | 814 | } elseif ($extCmd -is [Management.Automation.FunctionInfo]) { |
@@ -933,5 +917,5 @@ function Get-PipeScript |
933 | 917 | } |
934 | 918 | } |
935 | 919 | } |
936 | | -#endregion Piecemeal [ 0.3.2 ] : Easy Extensible Plugins for PowerShell |
| 920 | +#endregion Piecemeal [ 0.3.3 ] : Easy Extensible Plugins for PowerShell |
937 | 921 |
|
0 commit comments