<# FPS:Containers:Make:SN-Load-Common-Dependencies:ACTIVE #>

 

<#

.DESCRIPTION

Module: Make

Core Snippet: SN-Load-Common-Dependencies

 

When called, this snippet loads all of the functions used by a CmdLet with the Common module.

 

.USAGE

Similiar variations are used throughout FPS to load the dependencies for a module's public path

 

.EXAMPLE

 

# This should be the first active line in any CmdLet that has dependencies

. (Get-ActiveFileNm -PS1 Load-Common-Dependencies) }

 

Expected Result:

 

All CmdLets registered for a CmdLet are loaded

 

# This should be within the Initialization region in any CmdLet that has dependencies

. (Get-ActiveFileNm -PS1 Load-Make-Dependencies)

 

Expected Result:

 

All CmdLets registered for a CmdLet are loaded

 

.CC

 

[2024.11.16 JD] Reconfigured the snippet to use the second tier Load-Dependency snippet

[2024.09.25 JD] Original code release

 

.NOTES

 

$testCmdLet = "Get-Stub"

. (Get-ActiveFileNm -PS1 Initialize-Common-Locations)

 

Then the locational values associated with the Get-Stub CmdLet will be displayed.

 

 

DO NOT LOAD THE KEY CMDLETS: Get-Answer, Get-ActiveFileNm, Push-NeededFor, and Mount-Path

 

#>

 

if (($testCmdLet -gt "") -or ($overrideTestSnippet -gt "")) {

    if ($testCmdLet -gt "") { $cmnCallingCode = $testCmdLet }

    if ($overrideTestSnippet -gt "") { $cmnCallingCode = $overrideTestSnippet }

    $depPrintValue = $true

} else {

    if ($overrideSnippet -gt "") {

        $cmnCallingCode = $overrideSnippet

    } else {

        $cmnCallingCode = $PSCmdlet.MyInvocation.MyCommand.Name

    }

    $depPrintValue = $false

}

 

# Some overrides will use the full filename, but for shortcuts we only want the shortcut name

if ($cmnCallingCode -like 'SC-*') { $cmnCallingCode = $cmnCallingCode.replace('SC-','') }

 

switch ($cmnCallingCode) {

 

    # Shortcuts

 

    # Snippets

    'SN-SetDateFormats' { $ThisDependency = "ConvertTo-ZeroFill";. (Get-ActiveFileNm -PS1 Load-Dependency) }

 

    # CmdLets

    'Update-Log'        {

                            . (Get-ActiveFileNm -PS1 SN-SetDateFormats)

                            if ($depPrintValue -gt "") { Write-Host 'SN-SetDateFormats Loaded' }

 

                        }

 

    default { if ($depPrintValue -gt "") { Write-Host "$cmnCallingCode is not a configured option" } }

}