Skip to content

Commit c52d9ff

Browse files
committed
add help aliases
1 parent 7ba5a86 commit c52d9ff

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

src/powershell-extended/Invoke-NerdFontInstaller.ps1

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<#PSScriptInfo
44
5-
.VERSION 1.2.0
5+
.VERSION 1.2.1
66
77
.GUID a3238c59-8a0e-4c11-a334-f071772d1255
88
@@ -25,8 +25,10 @@
2525
.EXTERNALSCRIPTDEPENDENCIES
2626
2727
.RELEASENOTES
28-
Version 1.2.0 (2024-08-31)
28+
Version 1.2.1 (2024-08-31)
2929
- 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.
3032
#>
3133

3234
<#
@@ -249,7 +251,7 @@ param(
249251
[System.Management.Automation.CompletionResult]::new($_.Key, $_.Key, 'ParameterValue', $_.Value)
250252
}
251253
})]
252-
[string]$Help = 'Summary',
254+
[string]$Help = 'Help',
253255

254256
[Parameter(Mandatory = $true, ParameterSetName = 'Version')]
255257
[switch]$Version
@@ -499,7 +501,13 @@ param(`$commandName, `$parameterName, `$wordToComplete, `$commandAst, `$fakeBoun
499501
}
500502

501503
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+
) {
503511
try {
504512
if ($null -eq $PSCommandPath -or $PSCommandPath -eq '') {
505513
$scriptContent = $MyInvocation.MyCommand.ScriptBlock.ToString()
@@ -595,7 +603,13 @@ begin {
595603
return
596604
}
597605

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+
) {
599613
$scriptContent = $MyInvocation.MyCommand.ScriptBlock.ToString()
600614
$versionNumber = $null
601615
$inHelpBlock = $false

0 commit comments

Comments
 (0)