PythonPowershellUtilities.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$script:ModuleRoot = $PSScriptRoot
$script:ScriptDir = "$script:ModuleRoot\Functions"

#Taken from the DosInstallUtilities
function Import-Function{
    param(
        [string] $folderPath
    )

    $functionFiles = Get-ChildItem -Path $folderPath -Filter *.ps1

    Write-Verbose "Loading scripts in $folderPath"
    foreach($file in $functionFiles){
        Write-Verbose "Sourcing $($file.FullName)"
        . $file.FullName
    }
}

# Have to dot source the function call, otherwise the function are only loaded in the function scope (and not visible in to the module)
. Import-Function -folderPath $script:ScriptDir