-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathNerdioManagerPowerShell.psm1
More file actions
48 lines (41 loc) · 1.91 KB
/
NerdioManagerPowerShell.psm1
File metadata and controls
48 lines (41 loc) · 1.91 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
# region Generated
# Load the private module dll
$null = Import-Module -Name (Join-Path $PSScriptRoot './bin/NerdioManagerPowerShell.private.dll')
# Get the private module's instance
$instance = [NmePowershell.Module]::Instance
# Load the custom module
$customModulePath = Join-Path $PSScriptRoot './custom/NerdioManagerPowerShell.custom.psm1'
if(Test-Path $customModulePath) {
$null = Import-Module -Name $customModulePath
}
# Export nothing to clear implicit exports
Export-ModuleMember
# Export proxy cmdlet scripts
$exportsPath = Join-Path $PSScriptRoot './exports'
$directories = Get-ChildItem -Directory -Path $exportsPath
$profileDirectory = $null
if($instance.ProfileName) {
if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) {
$profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName }
} else {
# Don't export anything if the profile doesn't exist for the module
$exportsPath = $null
Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded."
}
} elseif(($directories | Measure-Object).Count -gt 0) {
# Load the last folder if no profile is selected
$profileDirectory = $directories | Select-Object -Last 1
}
if($profileDirectory) {
Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'"
$exportsPath = $profileDirectory.FullName
}
if($exportsPath) {
Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
$cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath
Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias)
}
# Finalize initialization of this module
$instance.Init();
Write-Information "Loaded Module '$($instance.Name)'"
# endregion