Shortcuts – Show

By | Published | No Comments

The Show shortcut is the core of the help facility in that all the variblization within FPS Aloha will be available for review here.  Initially the Show shortcut will display varibilization divisible by Module with profile information displayed as the default or with the -Pro switch.

In the past, similar Show shortcuts formed the output exclusively using hardcoded values within the shortcut itself.  For 90% of the use cases this was an acceptable way of designing the shortcut. The exception circumstance occurred when variables were added and/or changed within their host snippet or CmdLet and then not reflected within Show due to Show not being updated also.  To account for this circumstance, the Show configuration is also addressed when variables are created so that the Show shortcut will be naturally updated in place when the snippet/CmdLet is also update.  The way the descriptions will be designed will be via pipe “|” separated list utilizing a specialized Show variable identified within {DataResources:SC-Show}.

For example, the locations for {Make:SC-CICD} are first initialized within the {Make:SC-Show} shortcut, then an override is introduced before a call to {Make:SN-Initialize-Make-Locations} to indicate the fetch of variable for the CICD shortcut, and while the locations are being set the variable $showBuff is populated with the values of each variable.  A representative set of code for documenting this design is as follows:

First, within Show, the override indicating that the variables for CICD are desired and the returned buffer ($showBuff) is nulled out.  Then the snippet containing the Make locations is called.

$overrideSrc, $showBuff = 'CICD', ''
. (Get-ActiveFileNm -PS1 Initialize-Make-Locations)

Upon entering the Make location file, the override is evaluated in place of a standard CmdLet call and the desired switch is made within $makCallingCode. 

if ($overrideSrc -gt "") {
    $makCallingCode = $overrideSrc
} else {
    $makCallingCode = $PSCmdlet.MyInvocation.MyCommand.Name
}

Then the master switch is called and enters the CICD portion. After each locational variable is created for CICD, a Show entry is also created.  When CICD runs, the $showBuff info is obviously not used, but since it is in context with the original set of the variable, the chances of Show not correctly representing current variables drops to near zero. 

switch ($makCallingCode) {

# Shortcuts
'CICD'    {   # Review Make:SC-Show when changes are made
              $makLoc_CICDSourceContainers = $global:pro_CI.SourceDrive+"\FPS\Containers"
              $showBuff += 'CICD: $makLoc_CICDSourceContainers ............. '+$makLoc_CICDSourceContainers+'|'
              $makLoc_CICDTargetContainers = Mount-Path ($global:pro_CI.RuntimeDrive+"\FPS\Containers")
              $showBuff += 'CICD: $makLoc_CICDTargetContainers ............. '+$makLoc_CICDTargetContainers+'|'      
              $makLoc_CICDSourceMetadata = $global:pro_CI.SourceDrive+"\FPS\Metadata"
              $showBuff += 'CICD: $makLoc_CICDSourceMetadata ............... '+$makLoc_CICDSourceMetadata+'|'      
              $makLoc_CICDTargetMetadata = Mount-Path ($global:pro_CI.RuntimeDrive+"\FPS\Metadata")
              $showBuff += 'CICD: $makLoc_CICDTargetMetadata ............... '+$makLoc_CICDTargetMetadata+'|'
              $makLoc_CICDSourceMedia = $global:pro_CI.SourceDrive+"\FPS\Media"
              $showBuff += 'CICD: $makLoc_CICDSourceMediaSrc ............... '+$makLoc_CICDSourceMediaSrc+'|'
              $makLoc_CICDSourceWebLocal = $makLoc_CICDSourceMedia+"\Web"
              $showBuff += 'CICD: $makLoc_CICDSourceWebLocal ............... '+$makLoc_CICDSourceWebLocal+'|'
              $makLoc_CICDTargetWebLocal = Mount-Path ($global:pro_CIBase.RuntimeMedia+"\Web")
              $showBuff += 'CICD: $makLoc_CICDTargetWebLocal ............... '+$makLoc_CICDTargetWebLocal+'|'
              $makLoc_CICDSourcePublicHTML = $makLoc_CICDSourceMedia+"\public_html"
              $showBuff += 'CICD: $makLoc_CICDSourcePublicHTML ............. '+$makLoc_CICDSourcePublicHTML+'|'
              $makLoc_CICDTargetPublicHTML = Mount-Path ($global:pro_CIBase.RuntimeMedia+"\public_html")
              $showBuff += 'CICD: $makLoc_CICDTargetPublicHTML ............. '+$makLoc_CICDTargetPublicHTML+'|'
         }

And finally the created $showBuff is added to the overall Show buffer ($sBuff) so it can be reused for the next call retrieving Make variables.

       $sBuff += $showBuff # Adds the CICD locational Variables to the list

As noted above, $showBuff is the preferred buffer used elsewhere indicating the variables in use.  This has been automated as much as possible within Show so that 99.9% of the maintenance will be in context with the variables use – meaning that the process will recognize new entries, and deleted ones, and will update the Show shortcut when variables are added/deleted/changed.  If there is a new contextual Show construct, such as Cis within a domain, then that will have to be configured within Show in accordance to how the data is built.

As mentioned before, the Profile variables are the only non-location specific variables that are displayed by Show.  These variables use the global $global:sProShowBuff to store the profile values and this array is built upon startup.  This is the only perpetual variable used at this time to store Show values.  Within this release, due to the contextual aspect of show formats, 100% of the variables used are defined dynamically and there is 0% chance of variable definition missed within FPS Aloha.

CmdLets designed for the Show shortcut:

Module: Common

Private CmdLet: ConvertTo-DotFill.ps1

Dependencies: NA

The method used for right padding the sent string with “dots” to create a neatly aligned list of show elements.  It uses the variable $global:ShowDotLen identified in the Profile.ps1 file to derive the number of dots to fill the string with.  An example of its use is as follows:

  $global:showBuff = (ConvertTo-DotFill $global:ShowDotLen ‘$makLocLogs’)+$global:makLocLogs+’|’

Also, the similarly designed variable $global:SCDotLen is used for the right dot file for Shortcut help lines.

Testing Considerations:

When variables are added they can first be inspected via Show for the correct format providing a zero-code testing platform for configured variables

Referenced Source Files

Source for SC-Show.ps1, ConvertTo-DotFill.ps1, SN-Initialize-Make-Locations.ps1, SC-CICD.ps1

Leave a Reply