|
2 | 2 |
|
3 | 3 | <#PSScriptInfo |
4 | 4 |
|
5 | | -.VERSION 1.2.0 |
| 5 | +.VERSION 1.2.1 |
6 | 6 |
|
7 | 7 | .GUID a3238c59-8a0e-4c11-a334-f071772d1255 |
8 | 8 |
|
|
25 | 25 | .EXTERNALSCRIPTDEPENDENCIES |
26 | 26 |
|
27 | 27 | .RELEASENOTES |
28 | | - Version 1.2.0 (2024-08-31) |
| 28 | + Version 1.2.1 (2024-08-31) |
29 | 29 | - Add -Help and -Version parameters to allow help for dynamic Name parameter and when running the script directly from the web. |
| 30 | + - Add alias for -Help parameter to allow using '?', 'help', and '--help' as special Name parameter values. |
| 31 | + - Add alias for -Version parameter to allow using 'version', 'ver', and '--version' as special Name parameter values. |
30 | 32 | #> |
31 | 33 |
|
32 | 34 | <# |
@@ -249,7 +251,7 @@ param( |
249 | 251 | [System.Management.Automation.CompletionResult]::new($_.Key, $_.Key, 'ParameterValue', $_.Value) |
250 | 252 | } |
251 | 253 | })] |
252 | | - [string]$Help = 'Summary', |
| 254 | + [string]$Help = 'Help', |
253 | 255 |
|
254 | 256 | [Parameter(Mandatory = $true, ParameterSetName = 'Version')] |
255 | 257 | [switch]$Version |
@@ -499,7 +501,13 @@ param(`$commandName, `$parameterName, `$wordToComplete, `$commandAst, `$fakeBoun |
499 | 501 | } |
500 | 502 |
|
501 | 503 | begin { |
502 | | - if ($PSBoundParameters.ContainsKey('Help')) { |
| 504 | + if ( |
| 505 | + $PSBoundParameters.ContainsKey('Help') -or |
| 506 | + ( |
| 507 | + $PSBoundParameters.Name.Count -eq 1 -and |
| 508 | + @('help', '--help', '?') -contains $PSBoundParameters.Name[0] |
| 509 | + ) |
| 510 | + ) { |
503 | 511 | try { |
504 | 512 | if ($null -eq $PSCommandPath -or $PSCommandPath -eq '') { |
505 | 513 | $scriptContent = $MyInvocation.MyCommand.ScriptBlock.ToString() |
@@ -595,7 +603,13 @@ begin { |
595 | 603 | return |
596 | 604 | } |
597 | 605 |
|
598 | | - if ($Version) { |
| 606 | + if ( |
| 607 | + $Version -or |
| 608 | + ( |
| 609 | + $PSBoundParameters.Name.Count -eq 1 -and |
| 610 | + @('version', '--version', 'ver') -eq $PSBoundParameters.Name[0] |
| 611 | + ) |
| 612 | + ) { |
599 | 613 | $scriptContent = $MyInvocation.MyCommand.ScriptBlock.ToString() |
600 | 614 | $versionNumber = $null |
601 | 615 | $inHelpBlock = $false |
|
0 commit comments