mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
feat(pwsh): render hyperlink for theme name
render hyperlink for theme name and themes location in Get-PoshThemes bold attribute removed since it's not really working in windows terminal(https://github.com/microsoft/terminal/issues/109)
This commit is contained in:
parent
e6cb3a5608
commit
410fb82e13
|
@ -77,6 +77,30 @@ function Set-PoshPrompt {
|
|||
(& $poshCommand --init --shell=pwsh --config="$config") | Invoke-Expression
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Returns an ansi formatted hyperlink
|
||||
if name not set, uri is used as the name of the hyperlink
|
||||
.EXAMPLE
|
||||
Get-Hyperlink
|
||||
#>
|
||||
function Get-Hyperlink {
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string]$uri,
|
||||
[string]$name
|
||||
)
|
||||
$esc = [char]27
|
||||
if ("" -eq $name) {
|
||||
$name = $uri
|
||||
}
|
||||
if ($env:WSL_DISTRO_NAME -ne $null){
|
||||
# wsl conversion if needed
|
||||
$uri= &wslpath -m $uri
|
||||
}
|
||||
return "$esc]8;;file://$uri$esc\$name$esc]8;;$esc\"
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Display a preview or a list of installed themes.
|
||||
|
@ -91,7 +115,6 @@ function Get-PoshThemes() {
|
|||
[Parameter(Mandatory = $false, HelpMessage = "List themes path")]
|
||||
$list
|
||||
)
|
||||
$esc = [char]27
|
||||
$consoleWidth = $Host.UI.RawUI.WindowSize.Width
|
||||
$logo = @'
|
||||
__ _____ _ ___ ___ ______ _ __
|
||||
|
@ -112,7 +135,7 @@ function Get-PoshThemes() {
|
|||
else {
|
||||
$poshCommand = Get-PoshCommand
|
||||
$themes | ForEach-Object -Process {
|
||||
Write-Host "Theme: $esc[1m$($_.BaseName.Replace('.omp', ''))$esc[0m"
|
||||
Write-Host "Theme: $(Get-Hyperlink -uri $_.fullname -name $_.BaseName.Replace('.omp', ''))"
|
||||
Write-Host ""
|
||||
& $poshCommand -config $($_.FullName) -pwd $PWD
|
||||
Write-Host ""
|
||||
|
@ -120,7 +143,7 @@ function Get-PoshThemes() {
|
|||
}
|
||||
Write-Host ("-" * $consoleWidth)
|
||||
Write-Host ""
|
||||
Write-Host "Themes location: $PSScriptRoot\themes"
|
||||
Write-Host "Themes location: $(Get-Hyperlink -uri "$PSScriptRoot/themes")"
|
||||
Write-Host ""
|
||||
Write-Host "To change your theme, use the Set-PoshPrompt command. Example:"
|
||||
Write-Host " Set-PoshPrompt -Theme jandedobbeleer"
|
||||
|
|
Loading…
Reference in a new issue