AzureExt.psm1

#region Aliases
### This section contains aliases that will be exported from the module.

### Import all aliases from the Aliases folder.
$AliasFileList = Get-ChildItem -Path $PSScriptRoot\Aliases\*Aliases.json;
foreach ($AliasFile in $AliasFileList){
    $AliasJson = ConvertFrom-Json -InputObject (Get-Content -Path $AliasFile -Raw);
    foreach ($Alias in $AliasJson.Aliases) {
        ### Validate that each alias has a name and value defined. The description is optional.
        if ($Alias.Name -and $Alias.Value) {
            $NewAlias = @{
                Name = $Alias.Name;
                Value = $Alias.Value;
                Description = $Alias.Description;
            }
            New-Alias @NewAlias;
        } else {
            Write-Warning -Message ('Alias skipped in file {0}' -f $AliasFile.Name);
        }
    }
}
#endregion

#region Functions

#region Public Functions
$FunctionList = Get-ChildItem -Path $PSScriptRoot\Functions\Public;
foreach ($Function in $FunctionList) {
    Write-Verbose -Message ('Importing function file: {0}' -f $Function.FullName);
    . $Function.FullName;
}
#endregion Public Functions

#region Private Functions
$FunctionList = Get-ChildItem -Path $PSScriptRoot\Functions\Private;
foreach ($Function in $FunctionList) {
    Write-Verbose -Message ('Importing function file: {0}' -f $Function.FullName);
    . $Function.FullName;
}
#endregion Private Functions

#endregion Functions

#region Import Argument Completers
$CompleterScriptList = Get-ChildItem -Path $PSScriptRoot\Completers;

foreach ($CompleterScript in $CompleterScriptList) {
    Write-Verbose -Message ('Import argument completer script: {0}' -f $CompleterScript.FullName);
    & $CompleterScript.FullName;
}
#endregion

#region Format Data

$FormatFileList = Get-ChildItem -Path "$PSScriptRoot\Format Types" -Filter *format.ps1xml;
foreach ($FormatFile in $FormatFileList) {
    Update-FormatData -PrependPath $FormatFile.FullName;
}

#endregion