oh-my-posh: Export broken in YAML: map type properties do not parse correctly

Code of Conduct

  • I agree to follow this project’s Code of Conduct

What happened?

If I start with a valid yaml config from v5, the migration process does not work, and Set-PoshPrompt hangs. With a semi-complicated yaml file, the “migrated” file winds up just with the schema and version info, nothing else. With the simple theme file below, Set-PoshPrompt adds the version property and alphabetizes the other properties – but it doesn’t transform prefix and postfix into template, and the call never returns. With a more complicated file, the “transformed” yaml only contains the version property, nothing else.

Maybe this is a known issue?

Theme

$schema: https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
blocks:
  - type: prompt,
    alignment: left,
    segments:     
      - type: shell,
        style: plain,
        properties:
          prefix: ''
          postfix: '> '

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Version: 7.37.2

Segments:

ConsoleTitle(false) -   0 ms -
shell(true)  -   1 ms - pwsh>

Run duration: 1.2272ms

Cache path: C:\Users\WDAGUtilityAccount\AppData\Local\oh-my-posh

Logs:

2022/03/13 15:05:32 Flags duration: 0s, args:
2022/03/13 15:05:32 Flags duration: 0s, args:
2022/03/13 15:05:32 Shell duration: 7.2514ms, args:
2022/03/13 15:05:32 debug: Getenv

2022/03/13 15:05:32 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/03/13 15:05:32 debug: Pwd
C:\Users\WDAGUtilityAccount\Documents\PowerShell
2022/03/13 15:05:32 Pwd duration: 0s, args:
2022/03/13 15:05:32 debug: Home
C:\Users\WDAGUtilityAccount
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 debug: Pwd
C:\Users\WDAGUtilityAccount\Documents\PowerShell
2022/03/13 15:05:32 Pwd duration: 0s, args:
2022/03/13 15:05:32 debug: Home
C:\Users\WDAGUtilityAccount
2022/03/13 15:05:32 Shell duration: 0s, args:
2022/03/13 15:05:32 Root duration: 0s, args:
2022/03/13 15:05:32 Shell duration: 0s, args:
2022/03/13 15:05:32 ErrorCode duration: 0s, args:
2022/03/13 15:05:32 IsWsl duration: 0s, args:
2022/03/13 15:05:32 debug: Pwd
C:\Users\WDAGUtilityAccount\Documents\PowerShell
2022/03/13 15:05:32 Pwd duration: 537.9µs, args:
2022/03/13 15:05:32 debug: Home
C:\Users\WDAGUtilityAccount
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 PathSeparator duration: 0s, args:
2022/03/13 15:05:32 User duration: 0s, args:
2022/03/13 15:05:32 Host duration: 63.5µs, args:
2022/03/13 15:05:32 GOOS duration: 0s, args:
2022/03/13 15:05:32 TemplateCache duration: 601.4µs, args:
2022/03/13 15:05:32 debug: Getenv
C:\Users\WDAGUtilityAccount\AppData\Local
2022/03/13 15:05:32 Getenv duration: 0s, args: LOCALAPPDATA
2022/03/13 15:05:32 CachePath duration: 0s, args:

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

They can be either format imho.

@ehawman-rosenberg there’s only one issue I still need to look at, YAML isn’t going anywhere.

@asherber found the fix for the other issue, not ideal but it will at least keep things working #1961. I’m still going to see if I can fix this issue.

@asherber yes, I was thinking in the exact same direction 😁 Allow me to draft something.

No rush on this, I’ve managed to migrate my theme file by hand.