summaryrefslogtreecommitdiffstats
path: root/install.ps1
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:30:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:30:46 +0000
commit0fd136032da867c46316931cf35fc361933ce76d (patch)
treeee1295e4221a722a32b91f0d9bdc41f68731ea1b /install.ps1
parentInitial commit. (diff)
downloadpowerline-fonts-0fd136032da867c46316931cf35fc361933ce76d.tar.xz
powerline-fonts-0fd136032da867c46316931cf35fc361933ce76d.zip
Adding upstream version 0~20240322.upstream/0_20240322upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'install.ps1')
-rw-r--r--install.ps141
1 files changed, 41 insertions, 0 deletions
diff --git a/install.ps1 b/install.ps1
new file mode 100644
index 0000000..b16cfa9
--- /dev/null
+++ b/install.ps1
@@ -0,0 +1,41 @@
+<#
+.SYNOPSIS
+ Installs the provided fonts.
+.DESCRIPTION
+ Installs all the provided fonts by default. The FontName
+ parameter can be used to pick a subset of fonts to install.
+.EXAMPLE
+ C:\PS> ./install.ps1
+ Installs all the fonts located in the Git repository.
+.EXAMPLE
+ C:\PS> ./install.ps1 furamono-, hack-*
+ Installs all the FuraMono and Hack fonts.
+.EXAMPLE
+ C:\PS> ./install.ps1 d* -WhatIf
+ Shows which fonts would be installed without actually installing the fonts.
+ Remove the "-WhatIf" to install the fonts.
+#>
+[CmdletBinding(SupportsShouldProcess)]
+param(
+ # Specifies the font name to install. Default value will install all fonts.
+ [Parameter(Position=0)]
+ [string[]]
+ $FontName = '*'
+)
+
+$fontFiles = New-Object 'System.Collections.Generic.List[System.IO.FileInfo]'
+foreach ($aFontName in $FontName) {
+ Get-ChildItem $PSScriptRoot -Filter "${aFontName}.ttf" -Recurse | Foreach-Object {$fontFiles.Add($_)}
+ Get-ChildItem $PSScriptRoot -Filter "${aFontName}.otf" -Recurse | Foreach-Object {$fontFiles.Add($_)}
+}
+
+$fonts = $null
+foreach ($fontFile in $fontFiles) {
+ if ($PSCmdlet.ShouldProcess($fontFile.Name, "Install Font")) {
+ if (!$fonts) {
+ $shellApp = New-Object -ComObject shell.application
+ $fonts = $shellApp.NameSpace(0x14)
+ }
+ $fonts.CopyHere($fontFile.FullName)
+ }
+}