AMONotifications.psm1
[CmdletBinding()] Param () Process { # Locate all the public and private function specific files [array]$PublicFunctions = Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath 'Public') -Filter '*.ps1' -ErrorAction SilentlyContinue [array]$PrivateFunctions = Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath 'Private') -Filter '*.ps1' -ErrorAction SilentlyContinue # Dot source the function files foreach ($FunctionFile in @($PublicFunctions + $PrivateFunctions)) { try { . $FunctionFile.FullName -ErrorAction Stop } catch [System.Exception] { throw "AMONotifications: Failed to import function '$($FunctionFile.FullName)' with error: $($_.Exception.Message)" } } Export-ModuleMember -Function $PublicFunctions.BaseName -Alias * } |