|
2 | 2 |
|
3 | 3 | <#PSScriptInfo
|
4 | 4 |
|
5 |
| -.VERSION 1.1.0 |
| 5 | +.VERSION 1.1.1 |
6 | 6 |
|
7 | 7 | .GUID a3238c59-8a0e-4c11-a334-f071772d1255
|
8 | 8 |
|
9 | 9 | .AUTHOR Julian Pawlowski
|
10 | 10 |
|
11 | 11 | .COPYRIGHT © 2024 Julian Pawlowski.
|
12 | 12 |
|
13 |
| -.TAGS nerd-fonts nerdfonts cascadia-code cascadia-code-nerd-font cascadia-code-powerline-font cascadia-mono cascadia-mono-nerd-font cascadia-mono-powerline-font |
| 13 | +.TAGS fonts nerdfonts cascadia-code cascadia-code-nerd-font cascadia-code-powerline-font cascadia-mono cascadia-mono-nerd-font cascadia-mono-powerline-font powershell powershell-script Windows MacOS Linux PSEdition_Core PSEdition_Desktop |
14 | 14 |
|
15 | 15 | .LICENSEURI https://github.com/jpawlowski/devcontainer-features/blob/main/LICENSE.txt
|
16 | 16 |
|
|
25 | 25 | .EXTERNALSCRIPTDEPENDENCIES
|
26 | 26 |
|
27 | 27 | .RELEASENOTES
|
28 |
| - Version 1.1.0 (2024-08-29) |
29 |
| - - Add support for multiple types of font archives |
30 |
| - - Add XDG compliance for determining the target folder for fonts |
| 28 | + Version 1.1.1 (2024-08-31) |
| 29 | + - Update tag metadata to include the PSEditions and platforms supported by the script |
31 | 30 | #>
|
32 | 31 |
|
33 | 32 | <#
|
@@ -192,7 +191,16 @@ param(
|
192 | 191 | [ValidateSet('AllUsers', 'CurrentUser')]
|
193 | 192 | [string]$Scope = 'CurrentUser',
|
194 | 193 |
|
195 |
| - [switch]$Force |
| 194 | + [Parameter(Mandatory = $false, ParameterSetName = 'ByAll')] |
| 195 | + [Parameter(Mandatory = $false, ParameterSetName = 'ByName')] |
| 196 | + [switch]$Force, |
| 197 | + |
| 198 | + # Hidde commands to help when used as a script block only |
| 199 | + [Parameter(Mandatory = $true, ParameterSetName = 'Help')] |
| 200 | + [switch]$Help, |
| 201 | + |
| 202 | + [Parameter(Mandatory = $true, ParameterSetName = 'Version')] |
| 203 | + [switch]$Version |
196 | 204 | )
|
197 | 205 |
|
198 | 206 | dynamicparam {
|
@@ -439,6 +447,70 @@ param(`$commandName, `$parameterName, `$wordToComplete, `$commandAst, `$fakeBoun
|
439 | 447 | }
|
440 | 448 |
|
441 | 449 | begin {
|
| 450 | + if ($Help) { |
| 451 | + $scriptContent = $MyInvocation.MyCommand.ScriptBlock.ToString() |
| 452 | + $helpContent = @() |
| 453 | + $inHelpBlock = $false |
| 454 | + $helpBlockFound = $false |
| 455 | + |
| 456 | + foreach ($line in $scriptContent -split "`n") { |
| 457 | + if ($line -match '^\s*<#' -and -not $helpBlockFound) { |
| 458 | + if ($line -notmatch '^\s*<#PSScriptInfo') { |
| 459 | + $inHelpBlock = $true |
| 460 | + } |
| 461 | + } |
| 462 | + if ($inHelpBlock) { |
| 463 | + $helpContent += $line |
| 464 | + } |
| 465 | + if ($line -match '#>\s*$' -and $inHelpBlock) { |
| 466 | + $inHelpBlock = $false |
| 467 | + $helpBlockFound = $true |
| 468 | + } |
| 469 | + if ($helpBlockFound -and -not $inHelpBlock) { |
| 470 | + break |
| 471 | + } |
| 472 | + } |
| 473 | + |
| 474 | + if ($helpContent) { |
| 475 | + $helpText = $helpContent -join "`n" |
| 476 | + Write-Output $helpText |
| 477 | + } else { |
| 478 | + Write-Output "No help content found." |
| 479 | + } |
| 480 | + return |
| 481 | + } |
| 482 | + |
| 483 | + if ($Version) { |
| 484 | + $scriptContent = $MyInvocation.MyCommand.ScriptBlock.ToString() |
| 485 | + $helpContent = @() |
| 486 | + $inHelpBlock = $false |
| 487 | + $helpBlockFound = $false |
| 488 | + |
| 489 | + foreach ($line in $scriptContent -split "`n") { |
| 490 | + if ($line -match '^\s*<#PSScriptInfo' -and -not $helpBlockFound) { |
| 491 | + $inHelpBlock = $true |
| 492 | + } |
| 493 | + if ($inHelpBlock) { |
| 494 | + $helpContent += $line |
| 495 | + } |
| 496 | + if ($line -match '#>\s*$' -and $inHelpBlock) { |
| 497 | + $inHelpBlock = $false |
| 498 | + $helpBlockFound = $true |
| 499 | + } |
| 500 | + if ($helpBlockFound -and -not $inHelpBlock) { |
| 501 | + break |
| 502 | + } |
| 503 | + } |
| 504 | + |
| 505 | + if ($helpContent) { |
| 506 | + $helpText = $helpContent -join "`n" |
| 507 | + Write-Output $helpText |
| 508 | + } else { |
| 509 | + Write-Output "No help content found." |
| 510 | + } |
| 511 | + return |
| 512 | + } |
| 513 | + |
442 | 514 | if ($PSBoundParameters.ContainsKey('List')) {
|
443 | 515 | # Set default value if List is null or empty
|
444 | 516 | if ([string]::IsNullOrEmpty($List)) {
|
|
0 commit comments