-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFont.psm1
More file actions
52 lines (44 loc) · 2.04 KB
/
Font.psm1
File metadata and controls
52 lines (44 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$commandsPath = Join-Path $PSScriptRoot Commands
:ToIncludeFiles foreach ($file in (Get-ChildItem -Path "$commandsPath" -Filter "*-*" -Recurse)) {
if ($file.Extension -ne '.ps1') { continue } # Skip if the extension is not .ps1
foreach ($exclusion in '\.[^\.]+\.ps1$') {
if (-not $exclusion) { continue }
if ($file.Name -match $exclusion) {
continue ToIncludeFiles # Skip excluded files
}
}
. $file.FullName
}
$myModule = $MyInvocation.MyCommand.ScriptBlock.Module
$ExecutionContext.SessionState.PSVariable.Set($myModule.Name, $myModule)
$myModule.pstypenames.insert(0, $myModule.Name)
New-PSDrive -Name $MyModule.Name -PSProvider FileSystem -Scope Global -Root $PSScriptRoot -ErrorAction Ignore
if ($home) {
$MyModuleProfileDirectory = Join-Path ([Environment]::GetFolderPath("LocalApplicationData")) $MyModule.Name
if (-not (Test-Path $MyModuleProfileDirectory)) {
$null = New-Item -ItemType Directory -Path $MyModuleProfileDirectory -Force
}
New-PSDrive -Name "My$($MyModule.Name)" -PSProvider FileSystem -Scope Global -Root $MyModuleProfileDirectory -ErrorAction Ignore
}
# Set a script variable of this, set to the module
# (so all scripts in this scope default to the correct `$this`)
$script:this = $myModule
#region Custom
$fontForge = $ExecutionContext.SessionState.InvokeCommand.GetCommand('fontforge','application')
if (-not $fontForge) {
if ($env:GITHUB_EVENT_PATH) {
"::group::Install Font Forge" | Out-Host
sudo apt-get install fontforge -y | Out-Host
if ($?) {
"FontForge Installed!" | Out-Host
}
"Fonts Found" | Out-Host
Get-Font | Out-Host
"::endgroup::" | Out-Host
$fontForge = $ExecutionContext.SessionState.InvokeCommand.GetCommand('fontforge','application')
} else {
Write-Warning "FontForge is not installed and in the path. Import/Export-Font will not work"
}
}
#endregion Custom
Export-ModuleMember -Alias * -Function * -Variable $myModule.Name