<# FPS:Containers:Make:SN-Load-Services-Dependencies:ACTIVE
#>
<#
.DESCRIPTION
Module: Make
Core Snippet: SN-Load-Services-Dependencies
When called, this snippet loads all of
the functions used by a CmdLet with the Services
module.
.USAGE
Similiar variations are used throughout FPS to
load the dependencies for a module's public path
.EXAMPLE
# This should be within the Initialization region in any CmdLet that has dependencies
. (Get-ActiveFileNm -PS1
Load-Services-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-Services-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 "") {
$svcCallingCode = $testCmdLet }
if ($overrideTestSnippet -gt "") {
$svcCallingCode = $overrideTestSnippet }
$depPrintValue = $true
} else {
if ($overrideSnippet -gt "") {
$svcCallingCode = $overrideSnippet
} else {
$svcCallingCode = $PSCmdlet.MyInvocation.MyCommand.Name
}
$depPrintValue = $false
}
# Some overrides will use the full filename, but for
shortcuts we only want the shortcut name
if ($svcCallingCode -like 'SC-*') { $svcCallingCode = $svcCallingCode.replace('SC-','') }
switch ($svcCallingCode) {
# Shortcuts
'Stub'
{ $ThisDependency = "Format-Stub";. (Get-ActiveFileNm -PS1 Load-Dependency) }
# Snippets
'SN-Stub' { $ThisDependency = "Format-Stub";. (Get-ActiveFileNm -PS1 Load-Dependency) }
# CmdLets
'Get-Stub' { $ThisDependency = "Format-Stub";. (Get-ActiveFileNm -PS1 Load-Dependency) }
default { if
($depPrintValue -gt "") { Write-Host "$svcCallingCode is not a configured option" } }
}