diff --git a/src/functions/completers.ps1 b/src/functions/completers.ps1 index c1709a2..8e7e329 100644 --- a/src/functions/completers.ps1 +++ b/src/functions/completers.ps1 @@ -1,9 +1,12 @@ -Register-ArgumentCompleter -CommandName Uninstall-Font, Get-Font -ParameterName Name -ScriptBlock { +Register-ArgumentCompleter -CommandName 'Uninstall-Font', 'Get-Font' -ParameterName 'Name' -ScriptBlock { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) $null = $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters - if ([string]::IsNullOrEmpty($fakeBoundParameters['Scope'])) { - Get-Font -Scope 'CurrentUser' | Where-Object { $_.Name -like "$wordToComplete*" } | Select-Object -ExpandProperty Name + $scope = if ([string]::IsNullOrEmpty($fakeBoundParameters['Scope'])) { + 'CurrentUser' } else { - Get-Font -Scope $fakeBoundParameters['Scope'] | Where-Object { $_.Name -like "$wordToComplete*" } | Select-Object -ExpandProperty Name + $fakeBoundParameters['Scope'] + } + (Get-Font -Scope $scope).Name | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object { + [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } diff --git a/src/functions/public/Get-Font.ps1 b/src/functions/public/Get-Font.ps1 index 8af0dc2..7a4d53a 100644 --- a/src/functions/public/Get-Font.ps1 +++ b/src/functions/public/Get-Font.ps1 @@ -16,7 +16,7 @@ function Get-Font { ```powershell Name Path Scope ---- ---- ----- - Arial C:\Windows\Fonts\arial.ttf CurrentUser + Arial C:\Windows\Fonts\arial.ttf CurrentUser ``` Gets all the fonts installed for the current user. @@ -28,8 +28,8 @@ function Get-Font { ```powershell Name Path Scope ---- ---- ----- - Arial C:\Windows\Fonts\arial.ttf CurrentUser - Arial Bold C:\Windows\Fonts\arialbd.ttf CurrentUser + Arial C:\Windows\Fonts\arial.ttf CurrentUser + Arial Bold C:\Windows\Fonts\arialbd.ttf CurrentUser ``` Gets all the fonts installed for the current user that start with 'Arial'. @@ -41,7 +41,7 @@ function Get-Font { ```powershell Name Path Scope ---- ---- ----- - Calibri C:\Windows\Fonts\calibri.ttf AllUsers + Calibri C:\Windows\Fonts\calibri.ttf AllUsers ``` Gets all the fonts installed for all users. @@ -53,7 +53,7 @@ function Get-Font { ```powershell Name Path Scope ---- ---- ----- - Calibri C:\Windows\Fonts\calibri.ttf AllUsers + Calibri C:\Windows\Fonts\calibri.ttf AllUsers ``` Gets the font with the name 'Calibri' for all users. @@ -69,7 +69,7 @@ function Get-Font { - Scope: The scope from which the font is retrieved. .LINK - https://psmodule.io/Font/Functions/Get-Font + https://psmodule.io/Fonts/Functions/Get-Font/ #> [Alias('Get-Fonts')] [OutputType([System.Collections.Generic.List[PSCustomObject]])] diff --git a/src/functions/public/Install-Font.ps1 b/src/functions/public/Install-Font.ps1 index 2d6299e..76fbd47 100644 --- a/src/functions/public/Install-Font.ps1 +++ b/src/functions/public/Install-Font.ps1 @@ -101,7 +101,7 @@ function Install-Font { Returns messages indicating success or failure of font installation. .LINK - https://psmodule.io/Admin/Functions/Install-Font/ + https://psmodule.io/Fonts/Functions/Install-Font/ #> [Alias('Install-Fonts')] [CmdletBinding(SupportsShouldProcess)] diff --git a/src/functions/public/Uninstall-Font.ps1 b/src/functions/public/Uninstall-Font.ps1 index d781320..b94f607 100644 --- a/src/functions/public/Uninstall-Font.ps1 +++ b/src/functions/public/Uninstall-Font.ps1 @@ -1,4 +1,6 @@ -function Uninstall-Font { +#Requires -Modules @{ ModuleName = 'Admin'; RequiredVersion = '1.1.6' } + +function Uninstall-Font { <# .SYNOPSIS Uninstalls a font from the system. @@ -41,7 +43,7 @@ The function does not return any objects. .LINK - https://psmodule.io/Admin/Functions/Uninstall-Font/ + https://psmodule.io/Fonts/Functions/Uninstall-Font/ #> [Alias('Uninstall-Fonts')] [CmdletBinding()]