JanDeDobbeleer / oh-my-posh

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

Migration to version 1 removes templates (black and white prompt) #1998

Closed ehafenmaier closed 2 years ago

ehafenmaier commented 2 years ago

Code of Conduct

What happened?

After upgrading oh-my-posh on [Windows 11/WSL2/Ubuntu 20.04] to version 7.49.0 the shared theme config between WSL2 and PowerShell get migrated to version 1 when using WSL2/Ubuntu. The migration to version 1 seems to strip out the "template" property from all the segments.

The same theme config file has been shared between WSL2 and PowerShell without issue up until this latest upgrade in WSL2/Ubuntu.

Screenshot 2022-03-27 182334

Windows 11 - WSL2

WSL2/Ubuntu: Version 20.04 Oh-My-Posh: Version 7.49.0

Windows 11 - PowerShell

PowerShell: Version 7.2.2 Oh-My-Posh: Version 7.52.0

Theme

dracula-erich.omp.json (After using WSL2/Ubuntu 20.04)

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "Output": "",
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "background": "#3d89c7",
          "foreground": "#ffffff",
          "style": "powerline",
          "trailing_diamond": "\ue0b0",
          "type": "os"
        },
        {
          "background": "#8463c2",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "max_depth": 1,
            "style": "agnoster_short"
          },
          "style": "powerline",
          "type": "path"
        },
        {
          "background": "#95ffa4",
          "foreground": "#193549",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "fetch_status": true,
            "fetch_upstream_icon": true
          },
          "style": "powerline",
          "type": "git"
        },
        {
          "background": "#3d89c7",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "style": "powerline",
          "type": "dotnet"
        },
        {
          "background": "#3d89c7",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "style": "powerline",
          "type": "go"
        }
      ],
      "type": "prompt"
    }
  ],
  "final_space": true,
  "version": 1
}

dracula-erich.omp.json.bak (Before using WSL2/Ubuntu 20.04)

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "background": "#3d89c7",
          "foreground": "#ffffff",
          "style": "powerline",
          "trailing_diamond": "\ue0b0",
          "type": "os",
          "template": " {{ if .WSL }}WSL {{ end }}{{.Icon}} "
        },
        {
          "background": "#8463c2",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "max_depth": 1,
            "style": "agnoster_short"
          },
          "style": "powerline",
          "type": "path"
        },
        {
          "background": "#95ffa4",
          "foreground": "#193549",
          "powerline_symbol": "\ue0b0",
          "template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uF044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uF046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uF692 {{ .StashCount }}{{ end }} ",
          "properties": {
            "fetch_status": true,
            "fetch_upstream_icon": true
          },
          "style": "powerline",
          "type": "git"
        },
        {
          "background": "#3d89c7",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "style": "powerline",
          "type": "dotnet",
          "template": " \ue70c {{ .Full }} "
        },
        {
          "background": "#3d89c7",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "style": "powerline",
          "type": "go"
        }
      ],
      "type": "prompt"
    }
  ],
  "final_space": true,
  "version": 2
}

What OS are you seeing the problem on?

Linux

Which shell are you using?

bash

Log output

Oh My Posh config migrated to version 1
Backup config available at /home/erich/.poshthemes/dracula-erich.omp.json.bak

Version: 7.49.0

Segments:

ConsoleTitle(false) -   0 ms -
os(true)      -   0 ms -  WSL at 
path(true)    -   1 ms -  ~
git(false)    -   0 ms -
dotnet(false) -   0 ms -
go(false)     -   0 ms -

Run duration: 1.999609ms

Cache path: /home/erich/.cache/oh-my-posh

Logs:

2022/03/27 22:01:07 Flags duration: 80ns, args:
2022/03/27 22:01:07 Flags duration: 140ns, args:
2022/03/27 22:01:07 debug: Getenv

2022/03/27 22:01:07 Getenv duration: 52.13µs, args: OMP_CACHE_DISABLED
2022/03/27 22:01:07 Root duration: 310ns, args:
2022/03/27 22:01:07 Shell duration: 334.08µs, args:
2022/03/27 22:01:07 ErrorCode duration: 40ns, args:
2022/03/27 22:01:07 debug: Getenv
Ubuntu
2022/03/27 22:01:07 Getenv duration: 950ns, args: WSL_DISTRO_NAME
2022/03/27 22:01:07 IsWsl duration: 2.18µs, args:
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 7.87µs, args:
2022/03/27 22:01:07 PathSeparator duration: 40ns, args:
2022/03/27 22:01:07 PathSeparator duration: 20ns, args:
2022/03/27 22:01:07 User duration: 100ns, args:
2022/03/27 22:01:07 Host duration: 500ns, args:
2022/03/27 22:01:07 GOOS duration: 20ns, args:
2022/03/27 22:01:07 TemplateCache duration: 368.19µs, args:
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 530ns, args:
2022/03/27 22:01:07 GOOS duration: 20ns, args:
2022/03/27 22:01:07 TemplateCache duration: 90ns, args:
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 760ns, args:
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 460ns, args:
2022/03/27 22:01:07 Flags duration: 30ns, args:
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 370ns, args:
2022/03/27 22:01:07 GOOS duration: 20ns, args:
2022/03/27 22:01:07 GOOS duration: 20ns, args:
2022/03/27 22:01:07 PathSeparator duration: 30ns, args:
2022/03/27 22:01:07 Flags duration: 20ns, args:
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 350ns, args:
2022/03/27 22:01:07 GOOS duration: 30ns, args:
2022/03/27 22:01:07 GOOS duration: 20ns, args:
2022/03/27 22:01:07 PathSeparator duration: 20ns, args:
2022/03/27 22:01:07 GOOS duration: 20ns, args:
2022/03/27 22:01:07 debug: Getenv
Ubuntu
2022/03/27 22:01:07 Getenv duration: 540ns, args: WSL_DISTRO_NAME
2022/03/27 22:01:07 IsWsl duration: 1.61µs, args:
2022/03/27 22:01:07 debug: RunCommand
//wsl.localhost/Ubuntu/home/erich
2022/03/27 22:01:07 RunCommand duration: 875.89µs, args: wslpath -m /home/erich
2022/03/27 22:01:07 StackCount duration: 50ns, args:
2022/03/27 22:01:07 TemplateCache duration: 110ns, args:
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 760ns, args:
2022/03/27 22:01:07 debug: Getenv
Ubuntu
2022/03/27 22:01:07 Getenv duration: 610ns, args: WSL_DISTRO_NAME
2022/03/27 22:01:07 IsWsl duration: 1.71µs, args:
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 390ns, args:
2022/03/27 22:01:07 GOOS duration: 30ns, args:
2022/03/27 22:01:07 HasCommand duration: 252.12µs, args: git
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 530ns, args:
2022/03/27 22:01:07 error: HasParentFilePath
stat /.git: no such file or directory
2022/03/27 22:01:07 HasParentFilePath duration: 4.6µs, args: .git
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 1.08µs, args:
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 430ns, args:
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 430ns, args:
2022/03/27 22:01:07 debug: Pwd
/home/erich
2022/03/27 22:01:07 Pwd duration: 430ns, args:
2022/03/27 22:01:07 debug: Getenv

2022/03/27 22:01:07 Getenv duration: 600ns, args: XDG_CACHE_HOME
2022/03/27 22:01:07 CachePath duration: 4.08µs, args:
JanDeDobbeleer commented 2 years ago

@ehafenmaier there was a stupid bug in the logic which causes this. Unfortunately this can't be applied retroactively. The fix is to update all oh-my-posh executables to the latest version and restore the config backup. Terribly sorry about this.

github-actions[bot] commented 7 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.