Gordon.psm1

$PsVersion = $PSVersionTable.PSVersion
if ($PsVersion.Major -le 5) {
    $BinaryModulePath = "$PSScriptRoot\net48"
}
else {
    $BinaryModulePath = "$PSScriptRoot\net6.0"
}
Write-Host "Running on PS $PsVersion, loading module from $BinaryModulePath"

# Import the actual binary module
Import-Module "$BinaryModulePath\Eos.Gordon.PowerShell.dll" -DisableNameChecking -Global

# Load alias functions from the 'Aliases' folder
Get-ChildItem $PSScriptRoot\Aliases | ForEach-Object {
    . $_.FullName
}

# Because using 'Export-ModuleMember' above causes binary cmdlets to no longer be exported automatically, we need to so explicitly.
$BinaryCmdlets = [Eos.Gordon.PowerShell.Globals]::EnumerateCmdletNames()
Export-ModuleMember -Cmdlet $BinaryCmdlets