Write-ANSIHyperLink PowerShell Code

title: ## Contents 
style: nestedList # TOC style (nestedList|inlineFirstLevel)
minLevel: 1 # Include headings from the specified level
maxLevel: 4 # Include headings up to the specified level
includeLinks: true # Make headings clickable
debugInConsole: false # Print debug info in Obsidian console

Overview

Sources:

  • **

Code Snippet

function Write-AnsiHyperlink {
<#
.SYNOPSIS
Creates an ANSI Hyperlink in a supported terminal such as Windows Terminal 1.4
#>
    [CmdletBinding()]
    param(
        #The Uri that you wish to have as part of the hyperlink
        [Parameter(Mandatory,ValueFromPipeline)][UriBuilder]$Uri,
        #The label text that will actually be shown in Windows Terminal
        [ValidateNotNullOrEmpty()][String]$Label = $Uri.uri
    )
 
    if ($PSVersionTable.PSVersion -lt '6.0.0') {
        $e = [char]27
    } else {
        $e = "`e"
    }
 
    "${e}]8;;{0}${e}`\{1}${e}]8;;${e}`\" -f $Uri.uri,$Label
}

Details

About

This note is about …

See Also


Appendix

Note created on 2024-05-03 and last modified on 2024-05-03.

LIST FROM [[PowerShell - Write-ANSIHyperLink]] AND -"CHANGELOG" AND -"04-RESOURCES/Code/PowerShell/PowerShell - Write-ANSIHyperLink"

(c) No Clocks, LLC | 2024