-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGet-SVGL.psm1
More file actions
36 lines (33 loc) · 1.21 KB
/
Get-SVGL.psm1
File metadata and controls
36 lines (33 loc) · 1.21 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
# Get the path to the module
$ModulePath = $PSScriptRoot
New-Alias -Name "svgl" -Value "Get-Svgl"
# Load private functions from the root Private directory only (no subdirectories)
$PrivateFunctionsPath = Join-Path -Path $ModulePath -ChildPath 'Private'
if (Test-Path -Path $PrivateFunctionsPath) {
$PrivateFunctions = Get-ChildItem -Path $PrivateFunctionsPath -Filter '*.ps1' -Depth 0 -ErrorAction SilentlyContinue
foreach ($Function in $PrivateFunctions) {
try {
. $Function.FullName
}
catch {
Write-Error -Message "Failed to import function $($Function.FullName): $_"
}
}
}
# Load all public functions
$PublicFunctionsPath = Join-Path -Path $ModulePath -ChildPath 'Public'
if (Test-Path -Path $PublicFunctionsPath) {
$PublicFunctions = Get-ChildItem -Path $PublicFunctionsPath -Filter '*.ps1' -Recurse -ErrorAction SilentlyContinue
foreach ($Function in $PublicFunctions) {
try {
. $Function.FullName
}
catch {
Write-Error -Message "Failed to import function $($Function.FullName): $_"
}
}
}
# Export public functions
$PublicFunctions | ForEach-Object {
Export-ModuleMember -Function $_.BaseName
}