TerminalBlocks.psm1

#Region '.\public\Get-CursorPosition.ps1' 0
function Get-CursorPosition {
    <#
        .SYNOPSIS
            Write a VT ANSI escape sequence to the host and capture the response
        .EXAMPLE
            $Point = Get-CursorPosition
            Gets the current cursor position as a Drawing.Point with X (Column) and Y (Row)
    #>

    [Alias("DECXCPR")]
    [CmdletBinding()]
    param()end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
        
    [Console]::Write("$([char]27)[?6n")
    $response = -join @(while ([Console]::KeyAvailable) { [Console]::ReadKey($true).KeyChar })
    Write-Verbose ($response -replace '\e', '`e')
    $Row, $Col, $Page = $response -replace '\e\[\??((?:\d+;)?\d+;\d+)R', '$1' -split ';'
    [PSCustomObject]@{
        Row = [int]$Row
        Col = [int]$Col
        Page = $Page ?? 1
        X = $Col
        Y = $Row
    }
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Get-CursorPosition.ps1' 24
#Region '.\public\New-TerminalBlock.ps1' 0
function New-TerminalBlock {
    <#
        .Synopsis
            Create PoshCode.TerminalBlock with variable background colors
        .Description
            Allows changing the foreground and background colors based on elevation or success.
 
            Tests elevation fist, and then whether the last command was successful, so if you pass separate colors for each, the Elevated*Color will be used when PowerShell is running as administrator and there is no error. The Error*Color will be used whenever there's an error, whether it's elevated or not.
        .Example
            New-TerminalBlock { Show-ElapsedTime } -ForegroundColor White -BackgroundColor DarkBlue -ErrorBackground DarkRed -ElevatedForegroundColor Yellow
 
            This example shows the time elapsed executing the last command in White on a DarkBlue background, but switches the text to yellow if elevated, and the background to red on error.
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'New is not state changing!')]
    [OutputType([PoshCode.TerminalBlock])]
    [CmdletBinding(DefaultParameterSetName = "Content")]
    [Alias("TerminalBlock", "Block")]
    param(
        # The text, object, or scriptblock to show as output
        [AllowNull()][EmptyStringAsNull()]
        [Parameter(Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName, ParameterSetName = "Content")] # , Mandatory=$true
        [Alias("InputObject")]
        $Content,

        # A special block that outputs just a newline (with no caps, ever)
        [Parameter(Mandatory, ParameterSetName = "Newline")]
        [switch]$Newline,

        # A special block that outputs an inverted Cap (to create gaps in PowerLine)
        [Parameter(Mandatory, ParameterSetName = "Spacer")]
        [switch]$Spacer,

        # A special block that stores the position it would have output at
        [Parameter(Mandatory, ParameterSetName = "StorePosition")]
        [switch]$StorePosition,

        # A special block that recalls to the position of a previous StorePosition block
        [Parameter(Mandatory, ParameterSetName = "RecallPosition")]
        [switch]$RecallPosition,

        [Alias("Prepend")]
        [String]$Prefix,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )
    process {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "ProcessBlock", "Enter"
        try {
                switch($PSCmdlet.ParameterSetName) {
            Newline {
                $PSBoundParameters["Content"] = [PoshCode.SpecialBlock]::NewLine
                $null = $PSBoundParameters.Remove("Newline")
            }
            Spacer {
                $PSBoundParameters["Content"] = [PoshCode.SpecialBlock]::Spacer
                $null = $PSBoundParameters.Remove("Spacer")
            }
            StorePosition {
                $PSBoundParameters["Content"] = [PoshCode.SpecialBlock]::StorePosition
                $null = $PSBoundParameters.Remove("StorePosition")
            }
            RecallPosition {
                $PSBoundParameters["Content"] = [PoshCode.SpecialBlock]::RecallPosition
                $null = $PSBoundParameters.Remove("RecallPosition")
            }
        }

        # The mind-blowing scriptblock hack ;-)
        if ($Content -is [string] -and $Content[0] -eq '{' -and $Content[-1] -eq '}') {
            $PSBoundParameters["Content"] = [ScriptBlock]::Create($Content.Substring(1, $Content.Length - 2))
        } elseif (@($Content).Count -gt 1) {
            $PSBoundParameters["Content"] = @(
                foreach($item in $Content) {
                    if ($item -is [string] -and $item[0] -eq '{' -and $item[-1] -eq '}') {
                        [ScriptBlock]::Create($item.Substring(1, $item.Length - 2))
                    } else {
                        $item
                    }
                }
            )
        }

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach($name in [System.Management.Automation.PSCmdlet]::CommonParameters) {
            $null = $PSBoundParameters.Remove($name)
        }

        [PoshCode.TerminalBlock]$PSBoundParameters
        } catch {
            Write-Information $_ -Tags "ProcessBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "ProcessBlock", "Leave"
        }
    }
}
#EndRegion '.\public\New-TerminalBlock.ps1' 84
#Region '.\public\Reset-LastExitCode.ps1' 0
function Reset-LastExitCode {
    end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
        $global:LASTEXITCODE = [PoshCode.TerminalBlock]::LastExitCode
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Reset-LastExitCode.ps1' 4
#Region '.\public\Show-AzureContext.ps1' 0
function Show-AzureContext {
    [Alias("AzureContextBlock","New-AzureContextBlock")]
    [CmdletBinding()]
    param(
        # A string to show before the output. Defaults to "$fg:32aee7&nf-mdi-azure;$fg:clear"
        $Prefix = "$fg:32aee7&nf-mdi-azure;$fg:clear",

        # Force imports the module if it's not imported
        # By default, this block only renders when Az.Accounts is imported.
        [switch]$Force,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            
    if ($Force -or (Get-Module Az.Accounts)) {
        if (($Context = Get-AzContext)) {
            $Context.Name
        }
    }
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-AzureContext.ps1' 18
#Region '.\public\Show-CondaContext.ps1' 0
function Show-CondaContext {
    <#
        .SYNOPSIS
            Shows the current anaconda context (if any)
        .DESCRIPTION
            Shows the current conda context (the value of the environment variable: CONDA_PROMPT_MODIFIER)
    #>

    [CmdletBinding()]
    param(
        # A string to show before the output. Defaults to "&nf-dev-python; "
        [string]$Prefix = "&nf-dev-python; ",

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            
    $Env:CONDA_PROMPT_MODIFIER
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-CondaContext.ps1' 15
#Region '.\public\Show-Date.ps1' 0
function Show-Date {
    <#
        .SYNOPSIS
            Get the current date and/or time (by default, just the time).
        .DESCRIPTION
            Just calls Get-Date and passes the -Format and -AsUTC parameters.
        .EXAMPLE
            Show-Date -Format "h\:mm"
 
            Shows the time in 12 hour format without seconds.
        .EXAMPLE
            Show-Date -Format "H\:mm" -AsUTC
 
            Shows the UTC time in 24 hour format without seconds.
    #>

    [OutputType([string])]
    [CmdletBinding(DefaultParameterSetName = "SimpleFormat")]
    param(
        # A DateTime format string such as "h\:mm\:ss". Defaults to "T"
        [Parameter(ParameterSetName = 'SimpleFormat')]
        [string]$Format = 'T',

        # Shows the current UTC date (and/or time).
        [switch]$AsUTC,

        [Alias("Prepend")]
        [String]$Prefix,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            
    # PS5 doesn't have -AsUTC
    if ($AsUTC) {
        Get-Date -Format $Format (Get-Date).ToUniversalTime()
    } else {
        Get-Date -Format $Format
    }
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-Date.ps1' 33
#Region '.\public\Show-DockerContext.ps1' 0
function Show-DockerContext {
    <#
        .SYNOPSIS
            Show the docker context
    #>

    [CmdletBinding()]
    param(
        # A string to show before the output. Defaults to "&whale;"
        [string]$Prefix = "&whale; ",

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            
    if (Get-Command docker) {
        if (($Context = docker context show)) {
            $Context
        }
    }
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-DockerContext.ps1' 17
#Region '.\public\Show-ElapsedTime.ps1' 0
function Show-ElapsedTime {
    <#
        .SYNOPSIS
            Get the time span elapsed during the execution of command (by default the previous command)
        .DESCRIPTION
            Calls Get-History to return a single command and returns the difference between the Start and End execution time
    #>

    [OutputType([string])]
    [CmdletBinding(DefaultParameterSetName = "SimpleFormat")]
    param(
        # A string to show before the output.
        [string]$Prefix = "&stopwatch;",

        # A Timespan format pattern such as "{0:ss\.fff}" defaults to "{0:d\d\ h\:mm\:ss\.fff}"
        # See https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings
        # See also: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
        [Parameter(ParameterSetName = 'SimpleFormat')]
        [string]$Format = "{0:d\d\ h\:mm\:ss\.fff}",

        # Automatically use different formats depending on the duration
        [Parameter(Mandatory, ParameterSetName = 'AutoFormat')]
        [switch]$Autoformat,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            
    $LastCommand = Get-History -Count 1
    if(!$LastCommand) { return "" }

    $Duration = $LastCommand.EndExecutionTime - $LastCommand.StartExecutionTime
    $Result = if ($Autoformat) {
        if ($Duration.Days -ne 0) {
            "{0:d\d\ h\:mm}" -f $Duration
        } elseif ($Duration.Hours -ne 0) {
            "{0:h\:mm\:ss}" -f $Duration
        } elseif ($Duration.Minutes -ne 0) {
            "{0:m\:ss\.fff}" -f $Duration
        } elseif ($Duration.Seconds -ne 0) {
            "{0:s\.fff}s" -f $Duration
        } elseif ($Duration.Milliseconds -gt 10) {
            ("{0:fff}ms" -f $Duration).Trim("0")
        } else {
            # 956 is μ (for microsecond), but Windows PowerShell has a hard time with UTF-8 unless there's a BOM, so this is for safety
            ("{0:ffffff}$([char]956)s" -f $Duration).Trim("0")
        }
    } else {
        $Format -f $Duration
    }
    $Result
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-ElapsedTime.ps1' 48
#Region '.\public\Show-ErrorCount.ps1' 0
function Show-ErrorCount {
    <#
        .SYNOPSIS
            Get a count of new errors from previous command
        .DESCRIPTION
            Detects new errors generated by previous command based on tracking last seen count of errors.
    #>

    [CmdletBinding()]
    param(
        # If set, always show the output
        [switch]$ShowZero,

        [Alias("Prepend")]
        [String]$Prefix,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            

    $Count = $global:Error.Count - $script:LastErrorCount
    $script:LastErrorCount = $global:Error.Count
    if ($ShowZero -or $Count -gt 0) {
        $Count
    }
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-ErrorCount.ps1' 20
#Region '.\public\Show-ExoNamespace.ps1' 0
function Show-ExoNamespace {
    <#
        .SYNOPSIS
            Shows the current Exchange Online Account Namespace
    #>

    [CmdletBinding()]
    param(
        # A string to show before the output. Defaults to "&nf-mdi-ship_wheel; "
        [string]$Prefix = "&nf-mdi-ship_wheel; ",

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            
    if (Get-Command Get-FederatedOrganizationIdentifier -ErrorAction Ignore) {
        (Get-FederatedOrganizationIdentifier).AccountNamespace
    }
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    } <# elseif (Get-Command Get-AcceptedDomain -ErrorAction Ignore) {
        (Get-AcceptedDomain).Where{ $_.Default }.Name
    } #>

}
#EndRegion '.\public\Show-ExoNamespace.ps1' 17
#Region '.\public\Show-HistoryId.ps1' 0
function Show-HistoryId {
    <#
        .SYNOPSIS
            Shows the ID of the command you're about to type (this WILL BE the History ID of the command you run)
    #>

    [CmdletBinding()]
    param(
        [Alias("Prepend")]
        [String]$Prefix,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor)end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            
    $MyInvocation.HistoryId
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-HistoryId.ps1' 10
#Region '.\public\Show-HostName.ps1' 0
function Show-HostName {
    <#
        .SYNOPSIS
            Gets the hostname of the current machine
        .DESCRIPTION
            Calls [Environment]::MachineName
    #>

    [OutputType([string])]
    [CmdletBinding(DefaultParameterSetName = "SimpleFormat")]
    param(
        [Alias("Prepend")]
        [String]$Prefix,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor)end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            
    [Environment]::MachineName
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-HostName.ps1' 13
#Region '.\public\Show-JobOutput.ps1' 0
function Show-JobOutput {
    <#
        .SYNOPSIS
            Shows the most recent output of a specific job.
        .DESCRIPTION
            Calls Get-Job and returns the last output
    #>

    [OutputType([string])]
    [CmdletBinding(DefaultParameterSetName = "SimpleFormat")]
    param(
        # The name of the job to show the output of
        $Name,

        [Alias("Prepend")]
        [String]$Prefix,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            
    $Job = Get-Job -Name $Name -ErrorAction SilentlyContinue
    if ($Job.Output.Count) {
        $Job.Output[-1]
    }
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}


#EndRegion '.\public\Show-JobOutput.ps1' 21
#Region '.\public\Show-KubeContext.ps1' 0
function Show-KubeContext {
    <#
        .SYNOPSIS
            Shows the current kubectl context
    #>

    [CmdletBinding()]
    param(
        # A string to show before the output. Defaults to "&nf-mdi-ship_wheel; "
        [string]$Prefix = "&nf-mdi-ship_wheel; ",

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            
    if (Get-Command kubectl -ErrorAction Ignore) {
        if (($Context = kubectl config current-context)) {
            $Context
        }
    }
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-KubeContext.ps1' 17
#Region '.\public\Show-LastExitCode.ps1' 0
function Show-LastExitCode {
    <#
        .SYNOPSIS
            Show the LASTEXITCODE
        .DESCRIPTION
            Shows the exit code for native apps if the last command failed and left a LASTEXITCODE
 
            Can also show something for CommandNotFound or attmpt to execute a non-executable application
    #>

    [OutputType([string])]
    [CmdletBinding()]
    param(
        # A string to show before the output. Defaults to "&bomb;"
        [string]$Prefix = "&bomb;",

        # If you want to show a status even on successful commands, set this
        [string]$Success = "",

        # A string to show when a CommandNotFoundException is thrown.
        # Defaults to "🔍"
        [string]$NotFound = "&magnifyingglasstiltedleft;",

        # A string to show when an ApplicationFailedException is thrown.
        # This is typical for non-executable files on 'nix
        # Defaults to "🚫"
        [string]$NotExecutable = "&prohibited;",

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            
    # If there was an error ...
    if (-not $? -or -not [PoshCode.TerminalBlock]::LastSuccess) {
        # We retrieve the InvocationInfo from the most recent error using $global:error[0]
        if ($LastError = $global:error[0]) {
            # If History[-1] matches Error[0].ErrorInvocationInfo then the last error was NOT a native command
            if ($LastError.InvocationInfo -and (Get-History -Count 1).CommandLine -eq $global:error[0].InvocationInfo.Line) {
                if ($NotFound -and $LastError.Exception -is [System.Management.Automation.CommandNotFoundException]) {
                    $NotFound
                } elseif ($NotExecutable -and $LastError.Exception -is [System.Management.Automation.ApplicationFailedException]) {
                    $NotExecutable
                }
            } else {
                if ([PoshCode.TerminalBlock]::LastExitCode -gt 0) {
                    [PoshCode.TerminalBlock]::LastExitCode.ToString()
                } elseif ($global:LASTEXITCODE -gt 0) {
                    $global:LASTEXITCODE
                }
            }
        }
    } elseif ($Success) {
        $Success
    }
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-LastExitCode.ps1' 51
#Region '.\public\Show-LocationStack.ps1' 0
function Show-LocationStack {
    <#
        .SYNOPSIS
            Show information about the location stack
            TODO: allow passing a stack name
            TODO: allow showing where popd would go to
    #>

    [CmdletBinding()]
    param(
        # If set, this string is repeated for each nested level
        # The default is "&raquo;" so "»»»" will be used for $NestedPromptlevel = 3
        [string]$RepeatCharacter ="&raquo;",

        # LevelStrings allows you to specify an array of exact values to use for each $NestedPromptlevel (starts at 1)
        # E.g.: @("&raquo;", "&raquo;&raquo;", "&raquo;3", "&raquo;4", "&raquo;5", "&raquo;6", "&raquo;7", "&raquo;8", "&raquo;9")
        [string[]]$LevelStrings,

        [string]$StackName = "",

        [Alias("Prepend")]
        [String]$Prefix,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )
    end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
                    if ($depth = [PoshCode.TerminalBlock]::GlobalSessionState.Path.LocationStack($StackName).count) {
            if ($RepeatCharacter) {
                $RepeatCharacter * $depth
            } elseif ($LevelStrings -and $LevelStrings.Length -ge $depth) {
                $LevelStrings[$depth - 1]
            } else {
                $depth
            }
        }
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-LocationStack.ps1' 32
#Region '.\public\Show-NestedPromptLevel.ps1' 0
function Show-NestedPromptLevel {
    <#
        .SYNOPSIS
            Show the nested prompt level (if any)
    #>

    [CmdletBinding()]
    param(
        # Count prefix is used as a prefix for the number
        # The default is "⛯ " so "⛯ 3" will be used for $NestedPromptlevel = 3
        [string]$CountPrefix = "&gear; ",

        # If set, Repeat is repeated for each nested level
        # E.g. if you set "*" then "***" will be used for $NestedPromptlevel = 3
        [string]$RepeatCharacter,

        # LevelStrings allows you to specify an array of exact values to use for each $NestedPromptlevel (starts at 1)
        # E.g.: @("&gear;", "&gear;&gear;", "&gear;3", "&gear;4", "&gear;5", "&gear;6", "&gear;7", "&gear;8", "&gear;9")
        [string[]]$LevelStrings,

        [Alias("Prepend")]
        [String]$Prefix,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )
    begin {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "BeginBlock", "Enter"
        try {
                        if (!$RepeatCharacter -and !$LevelStrings) {
            $PSBoundParameters["Prefix"] = $CountPrefix
        }
        } catch {
            Write-Information $_ -Tags "BeginBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "BeginBlock", "Leave"
        }
    }
    end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
                    if ($NestedPromptLevel) {
            if ($RepeatCharacter) {
                $RepeatCharacter * $NestedPromptLevel
            } elseif ($LevelStrings -and $LevelStrings.Length -ge $NestedPromptLevel) {
                $LevelStrings[$NestedPromptLevel-1]
            } else {
                $NestedPromptLevel
            }
        }
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-NestedPromptLevel.ps1' 37
#Region '.\public\Show-Path.ps1' 0
function Show-Path {
    <#
        .SYNOPSIS
            Get a shortened version of a path for human readability
        .DESCRIPTION
            Trims the length of the path using various techniques
    #>

    [CmdletBinding(DefaultParameterSetName = "Length")]
    param(
        # Optionally, a strict maximum length of path to display
        # Path will be truncated to ensure it's shorter
        [Parameter(Position = 0)]
        [int]$Length = [int]::MaxValue,

        # Optionally, a strict maximum number of levels of path to display
        # Path will be truncated to ensure it's shorter
        [Parameter()]
        [int]$Depth = [int]::MaxValue,

        # Show the drive name on the front. Does not count toward length
        [switch]$DriveName,

        # A character to use for $Home. Defaults to "~"
        # You can use "&House;" to get 🏠 if you have Pansies set to EnableEmoji!
        # NOTE: this is based on the provider.
        # By default, only the FileSystem provider has a Home, but you can set them!
        [string]$HomeString = "~",

        # Only shows the path down to the root of git projects
        [switch]$GitDir,

        # Show only the first letter for all directories except the last one
        [Parameter()]
        [switch]$SingleLetterPath,

        # Show the first letter instead of truncating
        [Parameter()]
        [switch]$LeftoversAsOneLetter,

        # Optionally, turn it into a hyperlink to the full path.
        # In Windows Terminal, for instance, this makes it show the full path on hover, and open your file manager on ctrl+click
        [Parameter()]
        [switch]$AsUrl,

        # The path to show (defaults to $pwd, the present working directory)
        [Alias("InputObject")]
        [string]$Path,

        [Alias("Prepend")]
        [String]$Prefix,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )

    end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
                    # If user passes 0 (or less), I just refuse to deal with it
        if ($Length -le 0 -or $Depth -le 0) {
            return [string]::Empty
        }
        if (!$Path) {
            $Path = "$Pwd"
        }

        $OriginalPath = $Path
        $resolved = Resolve-Path $Path
        $provider = $resolved.Provider

        $Drive = $resolved.Drive.Name + ":"
        $Path = $resolved.Path

        $BaseHome = $Provider.Home
        Write-Verbose "ProviderHome: $BaseHome"

        if ($GitDir -and "FileSystem" -eq $Provider.Name -and (Get-Command git -ErrorAction Ignore)) {
            Push-Location $OriginalPath -StackName "Show-Path"
            $toplevel = git rev-parse --show-toplevel 2>$null | Convert-Path
            Write-Verbose "GitDir: $TopLevel"
            Write-Verbose "Path: $Path"
            if (!$LastExitCode -and $Path.StartsWith($TopLevel, "OrdinalIgnoreCase")) {
                $Path = $Path.SubString($TopLevel.Length)
                # If we're in a gitdir, we insist on showing it (using driveName logic)
                $Drive = Split-Path $TopLevel -Leaf
                $DriveName = $true
                $Depth = $Depth - 1
                Write-Verbose "Full: $Path"
            } else {
                Write-Verbose "Clear LastExitCode $global:LastExitCode"
                $global:LastExitCode = 0
            }
            Pop-Location -StackName "Show-Path"
        }

        if ($Path) {
            if ($HomeString -and $BaseHome -and $Path.StartsWith($BaseHome, "OrdinalIgnoreCase")) {
                # If we're in $HOME, we insist on showing it (using driveName logic)
                $Drive = ''
                $DriveName = $false
                $Path = $HomeString + $Path.Substring($BaseHome.Length)
            } else {
                $Path = Split-Path $Path -NoQualifier
            }

            if ($provider.ItemSeparator) {
                # Trust the provider's separator
                [PoshCode.Pansies.Text]$Path = $Path.Trim($provider.ItemSeparator)
                $Pattern = [regex]::Escape($provider.ItemSeparator)
                if (!$Separator) {
                    $Separator = $provider.ItemSeparator
                }
            } else {
                # Windows PowerShell
                [PoshCode.Pansies.Text]$Path = $Path.Trim("\")
                $Pattern = "\\"
                if (!$Separator) {
                    $Separator = "\"
                }
            }

            if ($SingleLetterPath) {
                # Remove prefix for UNC paths
                $Path = $Path -replace '^[^:]+::', ''
                $Folders = $Path -split $Pattern
                if ($Folders.Length -gt 1) {
                    # Supports emoji
                    $Folders = $Folders[0..($Folders.Count-2)].ForEach{ [System.Text.Rune]::GetRuneAt($_,0).ToString() } + @($Folders[-1])
                }
                $Path = $Folders -join $Separator
            } else {
                $Folders = $Path -split $Pattern
            }

            $Ellipsis = [char]0x2026

            if ($Path.Length -gt $Length -or $Folders.Length -gt $Depth) {
                [Array]::Reverse($Folders)
                # Start the path with just the last folder
                $Path, $Folders = $Folders
                $PathDepth = 1
                # If just the last folder is too long, truncate it
                if ("$Path".Length + 2 -gt $Length) {
                    Write-Verbose "$Path ($("$Path".Length) - $Length)"
                    $Path = $Ellipsis + "$Path".Substring("$Path".Length - $Length + 1)
                    if ($LeftoversAsOneLetter) {
                        $Folders = $Folders.ForEach{ [System.Text.Rune]::GetRuneAt($_,0).ToString() }
                        $Length = [int]::MaxValue
                    } else {
                        $Folders = @()
                    }
                }

                while ($Folders) {
                    $Folder, $Folders = $Folders

                    if ($Length -gt ("$Path".Length + $Folder.Length + 3) -and $Depth -gt $PathDepth) {
                        $Path = $Folder + $Separator + $Path
                    } elseif ($LeftoversAsOneLetter) {
                        # Put back the $Folder as well
                        $Folders = @(@($Folder) + $Folders).ForEach{ [System.Text.Rune]::GetRuneAt($_,0).ToString() } + @($Drive.Trim($provider.ItemSeparator, $Separator))
                        $Depth = $Length = [int]::MaxValue
                        $DriveName = $False
                    } else {
                        $Path = $Ellipsis + $Separator + $Path
                        break
                    }
                    $PathDepth++
                }
            } else {
                $Path = $Path -replace $Pattern, $Separator
            }
        }

        if ($DriveName) {
            if ($Path) {
                $Path = $Drive + $Separator + $Path
            } else {
                $Path = $Drive
            }
        }

        if ($AsUrl -and "FileSystem" -eq $Provider.Name) {
            $8 = "$([char]27)]8;;"
            "$8{0}`a{1}$8`a" -f $OriginalPath, $Path
        } else {
            $Path
        }
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-Path.ps1' 183
#Region '.\public\Show-PoshGitStatus.ps1' 0
function Show-PoshGitStatus {
    <#
        .SYNOPSIS
            Shows the git status of the current working directory.
        .DESCRIPTION
            Calls PoshGit's Get-GitStatus & Write-GitStatus to display the git status
 
            Configure via $global:GitPromptSettings
    #>

    [OutputType([string])]
    [CmdletBinding()]
    param(
        [Alias("Prepend")]
        [String]$Prefix,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor)
    dynamicparam {
        $Parameters = [Management.Automation.RuntimeDefinedParameterDictionary]::new()
        if (Get-Module posh-git) {
            if ($global:GitPromptSettings) {
                foreach($Setting in $GitPromptSettings | Get-Member -Type Property) {
                    if ($Setting.Name -notin $MyInvocation.MyCommand.Parameters.Keys) {
                        # $Type = $GitPromptSettings.($Setting.Name).GetType()
                        $Type = $GitPromptSettings.GetType().GetProperty($Setting.Name).PropertyType
                        if ($Type -eq [bool]) {
                            $Type = [switch]
                        }

                        $param = [Management.Automation.RuntimeDefinedParameter]@{
                            Name          = $Setting.Name
                            ParameterType = $Type
                        }
                        $param.Attributes.Add(
                            [Parameter]@{
                                ParameterSetName = "__AllParameterSets"
                                Mandatory        = $false
                            }
                        )
                        # $param.Attributes.Add([ValidateSet]::new([String[]]@(...)))
                        $Parameters.Add($param.Name, $param)
                    }
                }
                $Parameters
            }
        }
    }
    # Use the BEGIN block for one-time setup that doesn't need to be re-calculated in the prompt every time
    begin {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "BeginBlock", "Enter"
        try {
                        foreach($param in $PSBoundParameters.Keys) {
            if ($Parameters.ContainsKey($param)) {
                $global:GitPromptSettings.$param = $PSBoundParameters[$param]
            }
        }
        } catch {
            Write-Information $_ -Tags "BeginBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "BeginBlock", "Leave"
        }
    }
    # The end block will be turned into a closure and a TerminalBlock will be created
    end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
                    if (Get-Module posh-git) {
            Write-GitStatus (Get-GitStatus)
        }
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-PoshGitStatus.ps1' 58
#Region '.\public\Show-UserName.ps1' 0
function Show-UserName {
    <#
        .SYNOPSIS
            Gets the Username of the current machine
        .DESCRIPTION
            Calls [Environment]::UserName
    #>

    [OutputType([string])]
    [CmdletBinding(DefaultParameterSetName = "SimpleFormat")]
    param(
        [Alias("Prepend")]
        [String]$Prefix,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor)end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
            
    [Environment]::UserName
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-UserName.ps1' 13
#Region '.\public\Show-Version.ps1' 0
function Show-Version {
    <#
        .SYNOPSIS
            Gets Version information about the current host, PowerShell, and OS
        .DESCRIPTION
            Calls [Environment]::UserName
        .EXAMPLE
            Show-Version OSName, OSVersion, PSVersion -Label -Separator '' -BackgroundColor White -ForegroundColor Black
            | % ToString
    #>

    [OutputType([string])]
    [CmdletBinding(DefaultParameterSetName = "SimpleFormat")]
    param(
        # The version to show (default: PSVersion)
        [ValidateSet("OSName", "OSVersion", "Kernel", "NET", "PSVersion", "Host", "All")]
        [string[]]$Component,

        # Whether to include the label for each component (defaults to $true if $Component is "All")
        [switch]$Label,

        [Alias("Prepend")]
        [String]$Prefix,

        [Alias("Suffix", "Append")]
        [String]$Postfix,

        # The separator character(s) are used between blocks of output by this scriptblock
        # Pass two characters: the first for normal (Left aligned) blocks, the second for right-aligned blocks
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [String]$Separator,

        # The cap character(s) are used on the ends of blocks of output
        # Pass two characters: the first for the left side, the second for the right side.
        [ArgumentCompleter({
                [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new(
                    [System.Management.Automation.CompletionResult[]]@(
                        # The Consolas-friendly block characters ▌and▐ and ╲ followed by all the extended Terminal characters
                        @([string[]][char[]]@(@(0xe0b0..0xe0d4) + @(0x2588..0x259b) + @(0x256d..0x2572))).ForEach({
                                [System.Management.Automation.CompletionResult]::new("'$_'", $_, "ParameterValue", $_) })
                    ))
            })]
        [PoshCode.BlockCaps]$Caps,

        # The foreground color to use when the last command succeeded
        [Alias("ForegroundColor", "Fg", "DFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultForegroundColor,

        # The background color to use when the last command succeeded
        [Alias("BackgroundColor", "Bg", "DBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$DefaultBackgroundColor,

        # The foreground color to use when the process is elevated (running as administrator)
        [Alias("AdminFg", "AFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminForegroundColor,

        # The background color to use when the process is elevated (running as administrator)
        [Alias("AdminBg", "ABg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$AdminBackgroundColor,

        # The foreground color to use when the last command failed
        [Alias("ErrorFg", "EFg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorForegroundColor,

        # The background color to use when the last command failed
        [Alias("ErrorBg", "EBg")]
        [AllowNull()][EmptyStringAsNull()]
        [ArgumentCompleter([PoshCode.Pansies.Palettes.X11Palette])]
        [PoshCode.Pansies.RgbColor]$ErrorBackgroundColor
    )
    end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
                # Support default parameter values
        $Parameters = Get-ParameterValue
        $Parameters["Content"] = {
                    if ($Component -eq "All") {
            $Label = $true
            $Component = "OSName", "OSVersion", "Kernel", "NET", "PSVersion", "Host"
        }

        @(
            foreach ($Component in $Component) {
                @(
                    if ($Label) {
                        $Component + ":"
                    }
                    switch ($Component) {
                        "Host" {
                            $Host.Version.ToString()
                        }
                        "PSVersion" {
                            $PSVersionTable.PSVersion.ToString()
                        }
                        "Kernel" {
                            [Environment]::OSVersion.Version.ToString()
                        }
                        "NET" {
                            [Environment]::Version.ToString()
                        }
                        # We may need some help here, because I'm not sure this is enough _everywhere_
                        "OSName" {
                            if (Test-Path /etc/*-release) {
                                $Data = @{}
                                Get-Content /etc/*-release | ConvertFrom-StringData | ForEach-Object { $Data += $_ }
                                @($Data["DISTRIB_ID", "Name", "Id"].Trim(" `t`r`n`"'"))[0]
                            } elseif (Get-Command Get-CimInstance -ErrorAction Ignore) {
                                (Get-CimInstance Win32_OperatingSystem -Property Caption).Caption
                            } elseif ($IsMacOS) {
                                "MacOS"
                            }
                        }
                        "OSVersion" {
                            if (Test-Path /etc/*-release) {
                                $Data = @{}
                                Get-Content /etc/*-release | ConvertFrom-StringData | ForEach-Object { $Data += $_ }
                                @($Data["VERSION_ID", "DISTRIB_RELEASE", "VERSION", "PRETTY_NAME"].Trim(" `t`r`n`"'"))[0]
                            } elseif (Get-Command Get-CimInstance -ErrorAction Ignore) {
                                (Get-CimInstance Win32_OperatingSystem -Property BuildNumber).BuildNumber
                            } elseif ($IsMacOS) {
                                sw_vers -productVersion
                            }
                        }
                    }
                ) -join " "
            }
        ) -join $Separator
        }.GetNewClosure()

        # Strip common parameters if they're on here (so we can use -Verbose)
        foreach ($name in @($Parameters.Keys.Where{$_ -notin [PoshCode.TerminalBlock].GetProperties().Name})) {
            $null = $Parameters.Remove($name)
        }

        # Store the InvocationInfo for serialization
        $Parameters["MyInvocation"] = [System.Management.Automation.InvocationInfo].GetProperty("ScriptPosition", [System.Reflection.BindingFlags]"Instance,NonPublic").GetValue($MyInvocation).Text

        [PoshCode.TerminalBlock]$Parameters
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Show-Version.ps1' 75
#Region '.\public\Test-Elevation.ps1' 0
function Test-Elevation {
    <#
    .Synopsis
        Get a value indicating whether the process is elevated (running as administrator or root)
    #>

    [CmdletBinding()]
    param()end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
        
    [PoshCode.TerminalBlock]::Elevated
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Test-Elevation.ps1' 10
#Region '.\public\Test-Success.ps1' 0
function Test-Success {
    <#
    .Synopsis
        Get a value indicating whether the last command succeeded or not
    #>

    [CmdletBinding()]
    param()end {
        Write-Information "Enter $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Enter"
        try {
        
    [PoshCode.TerminalBlock]::LastSuccess
        } catch {
            Write-Information $_ -Tags "EndBlock", "Exception", "Unhandled"
            throw
        } finally {
            Write-Information "Leave $($PSCmdlet.MyInvocation.MyCommand.Name)" -Tags "EndBlock", "Leave"
        }
    }
}
#EndRegion '.\public\Test-Success.ps1' 10
#Region '.\Footer.ps1' 0
& {
    if (Get-Command Add-MetadataConverter -ErrorAction Ignore) {
        $AsConverters = @{}
        foreach($command in Get-Command Show-*, New-TerminalBlock -Module TerminalBlocks) {
            $AsConverters[$command.Name] = $command.ScriptBlock
        }
        Add-MetadataConverter $AsConverters
    }
}
#EndRegion '.\Footer.ps1' 10