TMConsole.Credentials.psm1

## Setup an apropriate quiet environment
$global:InformationPreference = 'Continue'
$global:ProgressPreference = 'Continue'
$global:VerbosePreference = 'SilentlyContinue'
$global:DebugPreference = 'SilentlyContinue'
$global:WarningPreference = 'SilentlyContinue'
$global:ErrorActionPreference = 'Continue' # Using 'Stop' will break execution and not throw errors to the next handler.
$global:ConfirmPreference = 'None'  ## Allows functions that would typically require confirmation to be overridden

## Load all files in the lib directory
$LibraryFiles = Get-ChildItem -Path $PSScriptRoot -Directory -Exclude 'Classes' | Get-ChildItem -Recurse -Force -File -Exclude '.gitkeep'

# For Each $Library File, load it
foreach ($LibraryFile in $LibraryFiles) {
    Write-Host "Loading: $($LibraryFile.FullName)"
    . ($LibraryFile.FullName)
}

$global:userFilesRoot = Join-Path -Path $HOME -ChildPath 'TMD_Files'

## User Paths
$global:userPaths = @{
    root             = $global:userFilesRoot
    debug            = Join-Path -Path $global:userFilesRoot -ChildPath "Debug"
    logs             = Join-Path -Path $global:userFilesRoot -ChildPath "Logs"
    queue            = Join-Path -Path $global:userFilesRoot -ChildPath "Queue"
    config           = Join-Path -Path $global:userFilesRoot -ChildPath "Config"
    input            = Join-Path -Path $global:userFilesRoot -ChildPath "Input"
    output           = Join-Path -Path $global:userFilesRoot -ChildPath "Output"
    credentials      = Join-Path -Path $global:userFilesRoot -ChildPath "Credentials"
    git              = Join-Path -Path $global:userFilesRoot -ChildPath "Git"
    referencedesigns = Join-Path -Path $global:userFilesRoot -ChildPath "Reference Designs"
}

## Confirm each user folder exists
$global:userPaths.Values | ForEach-Object {
    if (!(Test-Path $_)) {
        [void](New-Item -ItemType Directory -Force -Path $_)
    }
}

## User Paths
$global:userPaths = @{
    root             = $global:userFilesRoot
    debug            = Join-Path -Path $global:userFilesRoot -ChildPath "Debug"
    logs             = Join-Path -Path $global:userFilesRoot -ChildPath "Logs"
    queue            = Join-Path -Path $global:userFilesRoot -ChildPath "Queue"
    config           = Join-Path -Path $global:userFilesRoot -ChildPath "Config"
    input            = Join-Path -Path $global:userFilesRoot -ChildPath "Input"
    output           = Join-Path -Path $global:userFilesRoot -ChildPath "Output"
    credentials      = Join-Path -Path $global:userFilesRoot -ChildPath "Credentials"
    git              = Join-Path -Path $global:userFilesRoot -ChildPath "Git"
    referencedesigns = Join-Path -Path $global:userFilesRoot -ChildPath "Reference Designs"
}