Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🩹 [Patch]: Update argument completer to support Get-Font #36

Merged
merged 6 commits into from
Feb 14, 2025
9 changes: 9 additions & 0 deletions src/functions/completers.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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
} else {
Get-Font -Scope $fakeBoundParameters['Scope'] | Where-Object { $_.Name -like "$wordToComplete*" } | Select-Object -ExpandProperty Name
}
}
10 changes: 0 additions & 10 deletions src/functions/public/Uninstall-Font.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,3 @@ Please run the command again with elevated rights (Run as Administrator) or prov
Write-Verbose "[$functionName] - Done"
}
}

Register-ArgumentCompleter -CommandName Uninstall-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
} else {
Get-Font -Scope $fakeBoundParameters['Scope'] | Where-Object { $_.Name -like "$wordToComplete*" } | Select-Object -ExpandProperty Name
}
}
Loading