Skip to content

Feature (OWM) - Add ability to set the location parameter by an Environmental Variable#5478

Merged
JanDeDobbeleer merged 1 commit intoJanDeDobbeleer:nextfrom
JamesAndrewJackson13:feat-owm-set-location-by-env-var
Mar 3, 2025
Merged

Feature (OWM) - Add ability to set the location parameter by an Environmental Variable#5478
JanDeDobbeleer merged 1 commit intoJanDeDobbeleer:nextfrom
JamesAndrewJackson13:feat-owm-set-location-by-env-var

Conversation

@JamesAndrewJackson13
Copy link
Copy Markdown
Contributor

Prerequisites

  • I have read and understood the contributing guide.
  • The commit message follows the conventional commits guidelines.
  • Tests for the changes have been added (for bug fixes / features).
  • Docs have been added/updated (for bug fixes / features).

Description

Within the OWM segment, add the ability to set the location property via an environmental variable (just like how the API key can be set that way).

This allows for the location to be dynamically set, which allows for the location to be updated depending on where the user is. Useful for anyone running oh-my-posh on a laptop and changes location often. Without this change, if you want to do something like this you have to manually insert the location into the config file right before passing it to oh-my-posh (at least that's how I'm doing it; may not be the best method).

Note

For anyone curious about how you can get your location within PowerShell (on Windows), this stackoverflow post shows how to use the location-api. That gets your lat-long position. You'll then need to send that to a reverseGeocode api of some kind to get the city name, state code and country code (I was using Bing Maps API to do it, since it was free, but since that is getting shut down next year I've moved to Azure Maps).

@JanDeDobbeleer JanDeDobbeleer force-pushed the feat-owm-set-location-by-env-var branch from 5dcace9 to dbd56f2 Compare March 3, 2025 12:44
@JanDeDobbeleer JanDeDobbeleer changed the base branch from main to next March 3, 2025 12:44
@JanDeDobbeleer JanDeDobbeleer force-pushed the feat-owm-set-location-by-env-var branch from dbd56f2 to 9326498 Compare March 3, 2025 12:46
@JanDeDobbeleer JanDeDobbeleer merged commit 6ffe138 into JanDeDobbeleer:next Mar 3, 2025
7 checks passed
@JanDeDobbeleer
Copy link
Copy Markdown
Owner

@all-contributors please add @JamesAndrewJackson13 for code,doc

This is pure magic 🪄! @holopin-bot @JamesAndrewJackson13 wizard

@holopin-bot
Copy link
Copy Markdown

holopin-bot bot commented Mar 3, 2025

Congratulations @JamesAndrewJackson13, the maintainer of this repository has issued you a badge! Here it is: https://holopin.io/claim/cm7t28pfd92170cjupw2omkd0

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account.
Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!

@allcontributors
Copy link
Copy Markdown
Contributor

@JanDeDobbeleer

I've put up a pull request to add @JamesAndrewJackson13! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants