Skip to content

Commit 48e6ee0

Browse files
🩹 [Patch]: Bump Admin dependency to v1.1.6 (#45)
## Description This pull request includes updates to improve code consistency, enhance functionality, and update documentation for font-related PowerShell functions. The most important changes include adjustments to argument completers, module version updates, and corrected documentation links. ### Functional improvements: * [`src/functions/completers.ps1`](diffhunk://#diff-d85ead11500a80fca764d18c8480b383cdd0ae75862f268d0d4b4b997b27674bL1-R10): Refactored the `Register-ArgumentCompleter` block to improve readability and functionality by using a variable for the scope and returning results as `CompletionResult` objects. ### Dependency updates: * `src/functions/public/Get-Font.ps1`, `src/functions/public/Install-Font.ps1`, and `src/functions/public/Uninstall-Font.ps1`: Updated the required version of the `Admin` module from `1.1.5` to `1.1.6`. [[1]](diffhunk://#diff-ee20084ba781ca437e01d19ac7f613301852186eaaac3f2a2c56227290631228L1-R1) [[2]](diffhunk://#diff-d3add77d9955c82ca6cb9e9614242dfd502f6692662994dcb98d6a58b923abbfL1-R1) [[3]](diffhunk://#diff-2bda15615bb104b972c42d08b28af0a1692cbb5ec229ae212fc5959feab71f49L1-R3) ### Documentation fixes: * [`src/functions/public/Get-Font.ps1`](diffhunk://#diff-ee20084ba781ca437e01d19ac7f613301852186eaaac3f2a2c56227290631228L72-R72): Corrected the `.LINK` URL to reflect the updated path for the `Get-Font` function. * [`src/functions/public/Install-Font.ps1`](diffhunk://#diff-d3add77d9955c82ca6cb9e9614242dfd502f6692662994dcb98d6a58b923abbfL104-R104): Updated the `.LINK` URL for the `Install-Font` function to the correct path. * [`src/functions/public/Uninstall-Font.ps1`](diffhunk://#diff-2bda15615bb104b972c42d08b28af0a1692cbb5ec229ae212fc5959feab71f49L44-R46): Fixed the `.LINK` URL for the `Uninstall-Font` function to match the new structure. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 167efdb commit 48e6ee0

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

src/functions/completers.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
Register-ArgumentCompleter -CommandName Uninstall-Font, Get-Font -ParameterName Name -ScriptBlock {
1+
Register-ArgumentCompleter -CommandName 'Uninstall-Font', 'Get-Font' -ParameterName 'Name' -ScriptBlock {
22
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters)
33
$null = $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters
4-
if ([string]::IsNullOrEmpty($fakeBoundParameters['Scope'])) {
5-
Get-Font -Scope 'CurrentUser' | Where-Object { $_.Name -like "$wordToComplete*" } | Select-Object -ExpandProperty Name
4+
$scope = if ([string]::IsNullOrEmpty($fakeBoundParameters['Scope'])) {
5+
'CurrentUser'
66
} else {
7-
Get-Font -Scope $fakeBoundParameters['Scope'] | Where-Object { $_.Name -like "$wordToComplete*" } | Select-Object -ExpandProperty Name
7+
$fakeBoundParameters['Scope']
8+
}
9+
(Get-Font -Scope $scope).Name | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
10+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
811
}
912
}

src/functions/public/Get-Font.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function Get-Font {
1616
```powershell
1717
Name Path Scope
1818
---- ---- -----
19-
Arial C:\Windows\Fonts\arial.ttf CurrentUser
19+
Arial C:\Windows\Fonts\arial.ttf CurrentUser
2020
```
2121
2222
Gets all the fonts installed for the current user.
@@ -28,8 +28,8 @@ function Get-Font {
2828
```powershell
2929
Name Path Scope
3030
---- ---- -----
31-
Arial C:\Windows\Fonts\arial.ttf CurrentUser
32-
Arial Bold C:\Windows\Fonts\arialbd.ttf CurrentUser
31+
Arial C:\Windows\Fonts\arial.ttf CurrentUser
32+
Arial Bold C:\Windows\Fonts\arialbd.ttf CurrentUser
3333
```
3434
3535
Gets all the fonts installed for the current user that start with 'Arial'.
@@ -41,7 +41,7 @@ function Get-Font {
4141
```powershell
4242
Name Path Scope
4343
---- ---- -----
44-
Calibri C:\Windows\Fonts\calibri.ttf AllUsers
44+
Calibri C:\Windows\Fonts\calibri.ttf AllUsers
4545
```
4646
4747
Gets all the fonts installed for all users.
@@ -53,7 +53,7 @@ function Get-Font {
5353
```powershell
5454
Name Path Scope
5555
---- ---- -----
56-
Calibri C:\Windows\Fonts\calibri.ttf AllUsers
56+
Calibri C:\Windows\Fonts\calibri.ttf AllUsers
5757
```
5858
5959
Gets the font with the name 'Calibri' for all users.
@@ -69,7 +69,7 @@ function Get-Font {
6969
- Scope: The scope from which the font is retrieved.
7070
7171
.LINK
72-
https://psmodule.io/Font/Functions/Get-Font
72+
https://psmodule.io/Fonts/Functions/Get-Font/
7373
#>
7474
[Alias('Get-Fonts')]
7575
[OutputType([System.Collections.Generic.List[PSCustomObject]])]

src/functions/public/Install-Font.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function Install-Font {
101101
Returns messages indicating success or failure of font installation.
102102
103103
.LINK
104-
https://psmodule.io/Admin/Functions/Install-Font/
104+
https://psmodule.io/Fonts/Functions/Install-Font/
105105
#>
106106
[Alias('Install-Fonts')]
107107
[CmdletBinding(SupportsShouldProcess)]

src/functions/public/Uninstall-Font.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
function Uninstall-Font {
1+
#Requires -Modules @{ ModuleName = 'Admin'; RequiredVersion = '1.1.6' }
2+
3+
function Uninstall-Font {
24
<#
35
.SYNOPSIS
46
Uninstalls a font from the system.
@@ -41,7 +43,7 @@
4143
The function does not return any objects.
4244
4345
.LINK
44-
https://psmodule.io/Admin/Functions/Uninstall-Font/
46+
https://psmodule.io/Fonts/Functions/Uninstall-Font/
4547
#>
4648
[Alias('Uninstall-Fonts')]
4749
[CmdletBinding()]

0 commit comments

Comments
 (0)