Analyth.PowerShell.psm1

# Module: Analyth.PowerShell

#Requires -RunAsAdministrator

$moduleName = "Analyth.PowerShell"

# Import functions
$publicFunctions = Get-ChildItem -Path $PSScriptRoot\Functions\Public -Filter *.ps1

foreach ($function in $publicFunctions) {
    . $function.FullName
}

$privateFunctions = Get-ChildItem -Path $PSScriptRoot\Functions\Private -Filter *.ps1

foreach ($function in $privateFunctions) {
    . $function.FullName
}


# This command is automatically executed when the module is loaded to create aliases with prefix "ana" for all the functions
Get-Command -Module $moduleName | 
Where-Object { ($_.CommandType -eq "function" -and $_.Name -ne "Test-IsAdmin") } | 
ForEach-Object { $name = $_.Name ; Set-Alias "ana-$name" $name }