Skip to content

Commit

Permalink
Update tag metadata to include the PSEditions and platforms supported…
Browse files Browse the repository at this point in the history
… by the script
  • Loading branch information
jpawlowski committed Aug 31, 2024
1 parent aa59426 commit fa9a34f
Showing 1 changed file with 78 additions and 6 deletions.
84 changes: 78 additions & 6 deletions src/powershell-extended/Invoke-NerdFontInstaller.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<#PSScriptInfo
.VERSION 1.1.0
.VERSION 1.1.1
.GUID a3238c59-8a0e-4c11-a334-f071772d1255
.AUTHOR Julian Pawlowski
.COPYRIGHT © 2024 Julian Pawlowski.
.TAGS nerd-fonts nerdfonts cascadia-code cascadia-code-nerd-font cascadia-code-powerline-font cascadia-mono cascadia-mono-nerd-font cascadia-mono-powerline-font
.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
.LICENSEURI https://github.com/jpawlowski/devcontainer-features/blob/main/LICENSE.txt
Expand All @@ -25,9 +25,8 @@
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
Version 1.1.0 (2024-08-29)
- Add support for multiple types of font archives
- Add XDG compliance for determining the target folder for fonts
Version 1.1.1 (2024-08-31)
- Update tag metadata to include the PSEditions and platforms supported by the script
#>

<#
Expand Down Expand Up @@ -192,7 +191,16 @@ param(
[ValidateSet('AllUsers', 'CurrentUser')]
[string]$Scope = 'CurrentUser',

[switch]$Force
[Parameter(Mandatory = $false, ParameterSetName = 'ByAll')]
[Parameter(Mandatory = $false, ParameterSetName = 'ByName')]
[switch]$Force,

# Hidde commands to help when used as a script block only
[Parameter(Mandatory = $true, ParameterSetName = 'Help')]
[switch]$Help,

[Parameter(Mandatory = $true, ParameterSetName = 'Version')]
[switch]$Version
)

dynamicparam {
Expand Down Expand Up @@ -439,6 +447,70 @@ param(`$commandName, `$parameterName, `$wordToComplete, `$commandAst, `$fakeBoun
}

begin {
if ($Help) {
$scriptContent = $MyInvocation.MyCommand.ScriptBlock.ToString()
$helpContent = @()
$inHelpBlock = $false
$helpBlockFound = $false

foreach ($line in $scriptContent -split "`n") {
if ($line -match '^\s*<#' -and -not $helpBlockFound) {
if ($line -notmatch '^\s*<#PSScriptInfo') {
$inHelpBlock = $true
}
}
if ($inHelpBlock) {
$helpContent += $line
}
if ($line -match '#>\s*$' -and $inHelpBlock) {
$inHelpBlock = $false
$helpBlockFound = $true
}
if ($helpBlockFound -and -not $inHelpBlock) {
break
}
}

if ($helpContent) {
$helpText = $helpContent -join "`n"
Write-Output $helpText
} else {
Write-Output "No help content found."
}
return
}

if ($Version) {
$scriptContent = $MyInvocation.MyCommand.ScriptBlock.ToString()
$helpContent = @()
$inHelpBlock = $false
$helpBlockFound = $false

foreach ($line in $scriptContent -split "`n") {
if ($line -match '^\s*<#PSScriptInfo' -and -not $helpBlockFound) {
$inHelpBlock = $true
}
if ($inHelpBlock) {
$helpContent += $line
}
if ($line -match '#>\s*$' -and $inHelpBlock) {
$inHelpBlock = $false
$helpBlockFound = $true
}
if ($helpBlockFound -and -not $inHelpBlock) {
break
}
}

if ($helpContent) {
$helpText = $helpContent -join "`n"
Write-Output $helpText
} else {
Write-Output "No help content found."
}
return
}

if ($PSBoundParameters.ContainsKey('List')) {
# Set default value if List is null or empty
if ([string]::IsNullOrEmpty($List)) {
Expand Down

0 comments on commit fa9a34f

Please sign in to comment.