Public/Progress/Show-OrbitFunctionStatus.ps1

# Module: Orbit
# Function: Assertion
# Author: David Eberhardt
# Updated: 15-DEC-2020
# Status: Live




function Show-OrbitFunctionStatus {
  <#
    .SYNOPSIS
        Gives Feedback of FunctionStatus
    .DESCRIPTION
    On-Screen Output depends on Parameter Level
  .PARAMETER Level
    Level of Detail
    .EXAMPLE
    Show-OrbitFunctionStatus -Level <Level>
 
    "<Level>" may be Live, RC, Beta, Alpha, Unmanaged, Deprecated, Archived
  .INPUTS
    System.String
  .OUTPUTS
    System.Void
  .NOTES
    This will only ever show the status of the first Command in the Stack (i.E. when called from a function).
    It will not display the same information for any nested commands.
    Available options are:
    Alpha: Function in development. No guarantee of functionality. Here be dragons.
    Beta: Function in development. No guarantee of functionality
    RC: Release Candidate. Functionality is built
    Prelive: Live function that is only lacking Pester tests.
    Live: Live function that has proven with tests or without that it delivers.
 
    Unmanaged: Legacy Function from SkypeFunctions, not managed
    Deprecated: Function flagged for removal/replacement
    Archived: Function is archived
  .COMPONENT
    SupportingFunction
  .FUNCTIONALITY
    Removes old Module Versions retaining the most recent one installed
  .LINK
    https://github.com/DEberhardt/Orbit/tree/main/docs/Orbit.Tools/Show-OrbitFunctionStatus.md
  .LINK
    https://github.com/DEberhardt/Orbit/tree/main/docs/about/about_ModuleManagement.md
  .LINK
    https://github.com/DEberhardt/Orbit/tree/main/docs/
  #>


  [CmdletBinding()]
  param(
    [Validateset('Alpha', 'Beta', 'RC', 'Live', 'Unmanaged', 'Deprecated', 'Archived')]
    $Level
  ) #param

  #Show-OrbitFunctionStatus -Level Live

  # Setting Preference Variables according to Upstream settings
  if (-not $PSBoundParameters['Verbose']) { $VerbosePreference = $PSCmdlet.SessionState.PSVariable.GetValue('VerbosePreference') }
  $DebugPreference = if (-not $PSBoundParameters['Debug']) { $PSCmdlet.SessionState.PSVariable.GetValue('DebugPreference') } else { 'Continue' }
  $InformationPreference = if ( $PSBoundParameters['InformationAction']) { $PSCmdlet.SessionState.PSVariable.GetValue('InformationAction') } else { 'Continue' }

  $Stack = Get-PSCallStack
  if ($stack.length -gt 3) {
    return
  }
  else {
    $Function = ($Stack | Select-Object -First 2).Command[1]
    $IssueLink = 'https://github.com/DEberhardt/Orbit/issues/new'

    switch ($Level) {
      'Alpha' {
        $DebugPreference = 'Inquire'
        $VerbosePreference = 'Continue'
        Write-Debug -Message "$Function has [ALPHA] Status: It may not work as intended or contain serious gaps in functionality. Please handle with care" -Debug
      }
      'Beta' {
        $DebugPreference = 'Continue'
        $VerbosePreference = 'Continue'
        Write-Debug -Message "$Function has [BETA] Status: Build is not completed; functionality may be missing. Please report issues via GitHub ($IssueLink)"
      }
      'RC' {
        Write-Verbose -Message "$Function has [RC] Status: Testing still commences. Please report issues via GitHub ($IssueLink)" -Verbose
      }
      'Live' {
        Write-Verbose -Message "$Function is [LIVE]. Please report issues via GitHub ($IssueLink) or 'Orbit-Module@outlook.com'"
      }
      'Unmanaged' {
        Write-Verbose -Message "$Function is [LIVE] but [UNMANAGED] and comes as-is."
      }
      'Deprecated' {
        Write-Information "INFO: $Function is [LIVE] but [DEPRECATED]!"
      }
      'Archived' {
        Write-Information "INFO: $Function is [ARCHIVED]!"
      }
    }
    Write-Verbose -Message "Need help? Online: $global:OrbitHelpURLBase$Function`.md"
  }
} #Show-OrbitFunctionStatus