Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template global property for Oh My Posh version #6139

Closed
1 task done
LucaBlackDragon opened this issue Feb 4, 2025 · 2 comments
Closed
1 task done

Template global property for Oh My Posh version #6139

LucaBlackDragon opened this issue Feb 4, 2025 · 2 comments
Assignees
Labels
🚀 feat New feature

Comments

@LucaBlackDragon
Copy link

Code of Conduct

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

What would you like to see added?

I'd like to have a global property such as .OhMyPoshVersion to show the current Oh My Posh version in my shell, just like I can use the .ShellVersion global property to show the current shell version.

@LucaBlackDragon
Copy link
Author

For people who needs this feature, this is what I'm currently doing:

  1. declare an OHMYPOSH_VERSION environment variable in my PowerShell profile, e.g.:

    if (Get-Command oh-my-posh -ErrorAction SilentlyContinue) {
      $env:OHMYPOSH_VERSION = "$(oh-my-posh --version)"
    }
  2. use it in my Oh My Posh terminal templates, e.g.:

    "template": "{{if .Env.OHMYPOSH_VERSION}}Using OhMyPosh {{ .Env.OHMYPOSH_VERSION }}{{end}}"
    

Of course, I need to manually update the $env:OHMYPOSH_VERSION value each time I update Oh My Posh, but that's not a big issue!

@JanDeDobbeleer
Copy link
Owner

JanDeDobbeleer commented Feb 27, 2025

resolved in #6122 You can now use the global .Version property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 feat New feature
Projects
None yet
Development

No branches or pull requests

2 participants