Feature (OWM) - Add ability to set the location parameter by an Environmental Variable #5478
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prerequisites
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).