@@ -77,6 +77,30 @@ function Set-PoshPrompt {
77
77
(& $poshCommand -- init -- shell= pwsh -- config= " $config " ) | Invoke-Expression
78
78
}
79
79
80
+ <#
81
+ . SYNOPSIS
82
+ Returns an ansi formatted hyperlink
83
+ if name not set, uri is used as the name of the hyperlink
84
+ . EXAMPLE
85
+ Get-Hyperlink
86
+ #>
87
+ function Get-Hyperlink {
88
+ param (
89
+ [Parameter (Mandatory )]
90
+ [string ]$uri ,
91
+ [string ]$name
92
+ )
93
+ $esc = [char ]27
94
+ if (" " -eq $name ) {
95
+ $name = $uri
96
+ }
97
+ if ($env: WSL_DISTRO_NAME -ne $null ){
98
+ # wsl conversion if needed
99
+ $uri = & wslpath - m $uri
100
+ }
101
+ return " $esc ]8;;file://$uri$esc \$name$esc ]8;;$esc \"
102
+ }
103
+
80
104
<#
81
105
. SYNOPSIS
82
106
Display a preview or a list of installed themes.
@@ -91,7 +115,6 @@ function Get-PoshThemes() {
91
115
[Parameter (Mandatory = $false , HelpMessage = " List themes path" )]
92
116
$list
93
117
)
94
- $esc = [char ]27
95
118
$consoleWidth = $Host.UI.RawUI.WindowSize.Width
96
119
$logo = @'
97
120
__ _____ _ ___ ___ ______ _ __
@@ -112,15 +135,15 @@ function Get-PoshThemes() {
112
135
else {
113
136
$poshCommand = Get-PoshCommand
114
137
$themes | ForEach-Object - Process {
115
- Write-Host " Theme: $esc [1m $ ( $_.BaseName.Replace (' .omp' , ' ' )) $esc [0m "
138
+ Write-Host " Theme: $ ( Get-Hyperlink - uri $_.fullname - name $_ . BaseName.Replace (' .omp' , ' ' )) "
116
139
Write-Host " "
117
140
& $poshCommand - config $ ($_.FullName ) - pwd $PWD
118
141
Write-Host " "
119
142
}
120
143
}
121
144
Write-Host (" -" * $consoleWidth )
122
145
Write-Host " "
123
- Write-Host " Themes location: $PSScriptRoot \ themes"
146
+ Write-Host " Themes location: $ ( Get-Hyperlink - uri " $ PSScriptRoot/ themes" ) "
124
147
Write-Host " "
125
148
Write-Host " To change your theme, use the Set-PoshPrompt command. Example:"
126
149
Write-Host " Set-PoshPrompt -Theme jandedobbeleer"
0 commit comments