JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.01k stars 2.37k forks source link

Broken path hyper links with "mapped_locations_enabled": true (default) #3010

Closed stanio closed 1 year ago

stanio commented 1 year ago

Code of Conduct

What happened?

Windows Terminal, Git Bash, Path segment like:

        {
          "background": "yellow",
          "foreground": "black",
          "leading_diamond": "<black,yellow>\ue0b0</>",
          "powerline_symbol": "<yellow,black>\ue0b0",
          "properties": {
            "folder_separator_icon": "/",
            "max_depth": 4,
            "style": "agnoster_short",
            "mapped_locations_enabled": true,
            "home_icon": "\uF7DB"
          },
          "style": "diamond",
          "template": " {{ path .Path .Location }} ",
          "trailing_diamond": "\ue0b0",
          "type": "path"
        },

appears to generate non-functional links like file:\path\to\dir. Setting "mapped_locations_enabled": false generates functional links like file:C:\Users\<home>\path\to\dir.

Works in v12.1.0, broken in v12.2.0+.

Theme

Custom theme:

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "alignment": "right",
      "segments": [
        {
          "foreground": "green",
          "style": "plain",
          "template": "{{ if .SSHSession }}\uf817 {{ end }}{{ .UserName }}@{{ .HostName }} ",
          "type": "session"
        },
        {
          "foreground": "red",
          "properties": {
            "root_icon": "root"
          },
          "style": "plain",
          "template": "as \uf0e7 ",
          "type": "root"
        },
        {
          "foreground": "darkGray",
          "style": "plain",
          "template": "| {{ .CurrentDate | date .Format }} ",
          "type": "time"
        }
      ],
      "type": "prompt"
    },
    {
      "alignment": "left",
      "newline": true,
      "segments": [
        {
          "background": "magenta",
          "foreground": "black",
          "leading_diamond": "\ue0b6",
          "style": "diamond",
          "template": "{{ if .WSL }}WSL at {{ end }}{{.Icon}}",
          "trailing_diamond": "\ue0b0",
          "type": "os"
        },
        {
          "background": "yellow",
          "foreground": "black",
          "leading_diamond": "<black,yellow>\ue0b0</>",
          "powerline_symbol": "<yellow,black>\ue0b0",
          "properties": {
            "folder_separator_icon": "/",
            "max_depth": 4,
            "style": "agnoster_short",
            "mapped_locations_enabled": true,
            "home_icon": "\uF7DB"
          },
          "style": "diamond",
          "template": " {{ path .Path .Location }} ",
          "trailing_diamond": "\ue0b0",
          "type": "path"
        },
        {
          "background": "cyan",
          "foreground": "black",
          "leading_diamond": "<black,cyan>\ue0b0</>",
          "properties": {
            "branch_icon": "\ue0a0",
            "fetch_status": true,
            "fetch_upstream_icon": true,
            "untracked_modes": {
              "*": "no"
            }
          },
          "style": "diamond",
          "template": " {{ .HEAD }} {{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0}} \uf692 {{ .StashCount }}{{ end }}{{ if gt .WorktreeCount 0}} \uf1bb {{ .WorktreeCount }}{{ end }} ",
          "trailing_diamond": "\ue0b4",
          "type": "git"
        }
      ],
      "type": "prompt"
    },
    {
      "alignment": "left",
      "newline": true,
      "segments": [
        {
          "foreground": "lightWhite",
          "style": "plain",
          "template": "{{ if .Root }}#{{ else }}${{ end }} ",
          "type": "text"
        }
      ],
      "type": "prompt"
    }
  ],
  "version": 2
}

What OS are you seeing the problem on?

Windows

Which shell are you using?

bash

Log output

$ oh-my-posh debug

Version: 12.6.8

Segments:

ConsoleTitle(false) -   1 ms -
session(true)  -   0 ms - <user>@<machine>
root(false)    -   0 ms -
time(true)     -   0 ms - | 18:13:56
os(true)       -   0 ms - 
path(true)     -   0 ms -  /path/to/dir 
git(true)      - 366 ms -  work-in-progress ≢ 
text(true)     -   0 ms - $

Run duration: 416.182ms

Cache path: C:\Users\<home>\AppData\Local\oh-my-posh

Config path: C:/Users/<home>/.poshthemes/stanio.omp.json

Logs:

2022/10/24 18:13:56 debug: Getenv
C:\Users\<home>\AppData\Local
2022/10/24 18:13:56 Getenv duration: 0s, args: LOCALAPPDATA
2022/10/24 18:13:56 CachePath duration: 0s, args:
2022/10/24 18:13:56 debug: Getenv
C:/Users/<home>/.poshthemes/stanio.omp.json
2022/10/24 18:13:56 Getenv duration: 0s, args: POSH_THEME
2022/10/24 18:13:56 debug: Shell
process name: bash.exe
2022/10/24 18:13:56 Shell duration: 16.0803ms, args:
2022/10/24 18:13:56 resolveConfigPath duration: 16.0803ms, args:
2022/10/24 18:13:56 Init duration: 45.5983ms, args:
2022/10/24 18:13:56 Flags duration: 0s, args:
2022/10/24 18:13:56 config.loadConfig duration: 1.0586ms, args:
2022/10/24 18:13:56 Flags duration: 0s, args:
2022/10/24 18:13:56 debug: Getenv

2022/10/24 18:13:56 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/10/24 18:13:56 WindowsRegistryKeyValue duration: 0s, args: HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 debug: WindowsRegistryKeyValue
ColorizationColor(DWORD): 0xC4575775
2022/10/24 18:13:56 Root duration: 509.3µs, args:
2022/10/24 18:13:56 Shell duration: 0s, args:
2022/10/24 18:13:56 ErrorCode duration: 0s, args:
2022/10/24 18:13:56 IsWsl duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 debug: Pwd
C:\Users\<home>\path\to\dir
2022/10/24 18:13:56 Pwd duration: 0s, args:
2022/10/24 18:13:56 debug: Home
C:\Users\<home>
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 debug: User
<user>
2022/10/24 18:13:56 User duration: 0s, args:
2022/10/24 18:13:56 debug: Host
SAG-59QD373
2022/10/24 18:13:56 Host duration: 530µs, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 TemplateCache duration: 1.06ms, args:
2022/10/24 18:13:56 Flags duration: 0s, args:
2022/10/24 18:13:56 debug: Pwd
C:\Users\<home>\path\to\dir
2022/10/24 18:13:56 Pwd duration: 0s, args:
2022/10/24 18:13:56 debug: Home
C:\Users\<home>
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 debug: Getenv

2022/10/24 18:13:56 Getenv duration: 0s, args: SSH_CONNECTION
2022/10/24 18:13:56 debug: Getenv

2022/10/24 18:13:56 Getenv duration: 0s, args: SSH_CLIENT
2022/10/24 18:13:56 TemplateCache duration: 0s, args:
2022/10/24 18:13:56 TemplateCache duration: 0s, args:
2022/10/24 18:13:56 Shell duration: 0s, args:
2022/10/24 18:13:56 debug: Pwd
C:\Users\<home>\path\to\dir
2022/10/24 18:13:56 Pwd duration: 0s, args:
2022/10/24 18:13:56 debug: Home
C:\Users\<home>
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 Root duration: 0s, args:
2022/10/24 18:13:56 debug: Pwd
C:\Users\<home>\path\to\dir
2022/10/24 18:13:56 Pwd duration: 0s, args:
2022/10/24 18:13:56 debug: Home
C:\Users\<home>
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 TemplateCache duration: 0s, args:
2022/10/24 18:13:56 TemplateCache duration: 0s, args:
2022/10/24 18:13:56 Shell duration: 0s, args:
2022/10/24 18:13:56 Flags duration: 0s, args:
2022/10/24 18:13:56 debug: Pwd
C:\Users\<home>\path\to\dir
2022/10/24 18:13:56 Pwd duration: 0s, args:
2022/10/24 18:13:56 debug: Home
C:\Users\<home>
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 TemplateCache duration: 0s, args:
2022/10/24 18:13:56 TemplateCache duration: 0s, args:
2022/10/24 18:13:56 Shell duration: 0s, args:
2022/10/24 18:13:56 debug: Pwd
C:\Users\<home>\path\to\dir
2022/10/24 18:13:56 Pwd duration: 0s, args:
2022/10/24 18:13:56 debug: Home
C:\Users\<home>
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 debug: Pwd
C:\Users\<home>\path\to\dir
2022/10/24 18:13:56 Pwd duration: 0s, args:
2022/10/24 18:13:56 Shell duration: 0s, args:
2022/10/24 18:13:56 Shell duration: 0s, args:
2022/10/24 18:13:56 debug: Home
C:\Users\<home>
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 PathSeparator duration: 0s, args:
2022/10/24 18:13:56 IsWsl duration: 0s, args:
2022/10/24 18:13:56 StackCount duration: 0s, args:
2022/10/24 18:13:56 debug: Pwd
C:\Users\<home>\path\to\dir
2022/10/24 18:13:56 Pwd duration: 0s, args:
2022/10/24 18:13:56 DirIsWritable duration: 0s, args:
2022/10/24 18:13:56 TemplateCache duration: 0s, args:
2022/10/24 18:13:56 TemplateCache duration: 0s, args:
2022/10/24 18:13:56 Shell duration: 0s, args:
2022/10/24 18:13:56 debug: Pwd
C:\Users\<home>\path\to\dir
2022/10/24 18:13:56 Pwd duration: 0s, args:
2022/10/24 18:13:56 debug: Home
C:\Users\<home>
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 debug: CommandPath
C:\Program Files\Git\cmd\git.exe
2022/10/24 18:13:56 CommandPath duration: 8.4172ms, args: git.exe
2022/10/24 18:13:56 HasCommand duration: 8.4172ms, args: git.exe
2022/10/24 18:13:56 debug: Pwd
C:\Users\<home>\path\to\dir
2022/10/24 18:13:56 Pwd duration: 0s, args:
2022/10/24 18:13:56 HasParentFilePath duration: 0s, args: .git
2022/10/24 18:13:56 debug: Home
C:\Users\<home>
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 GOOS duration: 0s, args:
2022/10/24 18:13:56 debug: Getenv

2022/10/24 18:13:56 Getenv duration: 0s, args: POSH_GIT_STATUS
2022/10/24 18:13:57 debug: RunCommand
# branch.oid 95c4352bb04073486bb0db6bf9f30ee36daf56ba
# branch.head draft/nashorn-formula-eval
2022/10/24 18:13:57 RunCommand duration: 356.8298ms, args: git.exe -C C:/Users/<home>/path/to/dir --no-optional-locks -c core.quotepath=false -c color.status=false status -uno --branch --porcelain=2
2022/10/24 18:13:57 debug: HasFolder
false
2022/10/24 18:13:57 HasFolder duration: 0s, args: C:\Users\<home>\path\to\dir\.git/rebase-merge
2022/10/24 18:13:57 debug: HasFolder
false
2022/10/24 18:13:57 HasFolder duration: 0s, args: C:\Users\<home>\path\to\dir\.git/rebase-apply
2022/10/24 18:13:57 PathSeparator duration: 0s, args:
2022/10/24 18:13:57 debug: HasFilesInDir
false
2022/10/24 18:13:57 HasFilesInDir duration: 0s, args: MERGE_MSG
2022/10/24 18:13:57 PathSeparator duration: 0s, args:
2022/10/24 18:13:57 debug: HasFilesInDir
false
2022/10/24 18:13:57 HasFilesInDir duration: 0s, args: CHERRY_PICK_HEAD
2022/10/24 18:13:57 PathSeparator duration: 0s, args:
2022/10/24 18:13:57 debug: HasFilesInDir
false
2022/10/24 18:13:57 HasFilesInDir duration: 528.4µs, args: REVERT_HEAD
2022/10/24 18:13:57 PathSeparator duration: 0s, args:
2022/10/24 18:13:57 debug: HasFilesInDir
false
2022/10/24 18:13:57 HasFilesInDir duration: 0s, args: sequencer/todo
2022/10/24 18:13:57 TemplateCache duration: 0s, args:
2022/10/24 18:13:57 TemplateCache duration: 0s, args:
2022/10/24 18:13:57 Shell duration: 0s, args:
2022/10/24 18:13:57 Flags duration: 0s, args:
2022/10/24 18:13:57 debug: Pwd
C:\Users\<home>\path\to\dir
2022/10/24 18:13:57 Pwd duration: 0s, args:
2022/10/24 18:13:57 debug: Home
C:\Users\<home>
2022/10/24 18:13:57 GOOS duration: 0s, args:
2022/10/24 18:13:57 TemplateCache duration: 0s, args:
2022/10/24 18:13:57 TemplateCache duration: 0s, args:
2022/10/24 18:13:57 Shell duration: 0s, args:
2022/10/24 18:13:57 debug: Getenv
C:\Users\<home>\AppData\Local
2022/10/24 18:13:57 Getenv duration: 0s, args: LOCALAPPDATA
2022/10/24 18:13:57 CachePath duration: 0s, args:
2022/10/24 18:13:57 Flags duration: 0s, args:
github-actions[bot] commented 9 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.