JanDeDobbeleer / oh-my-posh

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

GCP Config Not Detected on Windows #2814

Closed GavinOsborn closed 2 years ago

GavinOsborn commented 2 years ago

Code of Conduct

What happened?

The GCP segment does not appear to load config from the correct location on windows - I don't know about other platforms.

oh-my-posh debug tells me that it searches for config in C:\Users\OsbornG\.config\gcloud\active_config but...

When I install the GCloud SDK with next next next defaults following the instructions on the website the command gcloud info reports the following config location:

Installation Properties: [C:\Users\OsbornG\AppData\Local\Google\Cloud SDK\google-cloud-sdk\properties]
User Config Directory: [C:\Users\OsbornG\AppData\Roaming\gcloud]
Active Configuration Name: [default]
Active Configuration Path: [C:\Users\OsbornG\AppData\Roaming\gcloud\configurations\config_default]

This is my first time installing the GCloud CLI on Windows so I'm unsure if this is a change in behavior.

Theme

{ "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "blocks": [ { "alignment": "left", "newline": false, "segments": [ { "background": "blue", "foreground": "yellow", "type": "gcp", "style": "powerline", "powerline_symbol": "\ue0b4", "template": "{{ if .Error }} {{ .Error }} {{ else }} {{ .Project }} {{ end }}" } ], "type": "prompt" } ], "version": 2 }

What OS are you seeing the problem on?

Windows

Which shell are you using?

bash, powershell

Log output

Version: 9.5.0

Segments:

ConsoleTitle(false) -   1 ms - 
gcp(true)  -   1 ms -  NO ACTIVE CONFIG FOUND 

Run duration: 26.0328ms

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

Config path: C:/Users/OsbornG/code/gav/oh-my-posh-themes/gcp-repro.omp.json

Logs:

2022/09/22 11:34:00 debug: Getenv
C:\Users\OsbornG\AppData\Local
2022/09/22 11:34:00 Getenv duration: 0s, args: LOCALAPPDATA
2022/09/22 11:34:00 CachePath duration: 0s, args: 
2022/09/22 11:34:00 debug: Getenv
C:/Users/OsbornG/code/gav/oh-my-posh-themes/gcp-repro.omp.json
2022/09/22 11:34:00 Getenv duration: 0s, args: POSH_THEME
2022/09/22 11:34:00 debug: Shell
process name: bash.exe
2022/09/22 11:34:00 Shell duration: 16.0711ms, args: 
2022/09/22 11:34:00 resolveConfigPath duration: 16.0711ms, args: 
2022/09/22 11:34:00 Init duration: 23.3444ms, args: 
2022/09/22 11:34:00 Flags duration: 0s, args: 
2022/09/22 11:34:00 config.loadConfig duration: 569.3µs, args: 
2022/09/22 11:34:00 Flags duration: 0s, args: 
2022/09/22 11:34:00 debug: Getenv

2022/09/22 11:34:00 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/09/22 11:34:00 WindowsRegistryKeyValue duration: 0s, args: HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 debug: WindowsRegistryKeyValue
ColorizationColor(DWORD): 0xC40078D7
2022/09/22 11:34:00 Root duration: 0s, args: 
2022/09/22 11:34:00 Shell duration: 0s, args: 
2022/09/22 11:34:00 ErrorCode duration: 0s, args: 
2022/09/22 11:34:00 IsWsl duration: 0s, args: 
2022/09/22 11:34:00 debug: Pwd
C:\Users\OsbornG
2022/09/22 11:34:00 Pwd duration: 0s, args: 
2022/09/22 11:34:00 debug: Home
C:\Users\OsbornG
2022/09/22 11:34:00 debug: Home
C:\Users\OsbornG
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 debug: User
OsbornG
2022/09/22 11:34:00 User duration: 0s, args: 
2022/09/22 11:34:00 debug: Host
MEL-PF3NJR4W
2022/09/22 11:34:00 Host duration: 0s, args: 
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 TemplateCache duration: 0s, args: 
2022/09/22 11:34:00 Flags duration: 0s, args: 
2022/09/22 11:34:00 debug: Pwd
C:\Users\OsbornG
2022/09/22 11:34:00 Pwd duration: 0s, args: 
2022/09/22 11:34:00 debug: Home
C:\Users\OsbornG
2022/09/22 11:34:00 GOOS duration: 0s, args: 
2022/09/22 11:34:00 debug: Getenv

2022/09/22 11:34:00 Getenv duration: 0s, args: CLOUDSDK_CONFIG
2022/09/22 11:34:00 debug: Home
C:\Users\OsbornG
2022/09/22 11:34:00 error: FileContent
open C:\Users\OsbornG\.config\gcloud\active_config: The system cannot find the path specified.
2022/09/22 11:34:00 FileContent duration: 549.5µs, args: C:\Users\OsbornG\.config\gcloud\active_config
2022/09/22 11:34:00 TemplateCache duration: 0s, args: 
2022/09/22 11:34:00 TemplateCache duration: 0s, args: 
2022/09/22 11:34:00 Shell duration: 0s, args: 
2022/09/22 11:34:00 debug: Getenv
C:\Users\OsbornG\AppData\Local
2022/09/22 11:34:00 Getenv duration: 0s, args: LOCALAPPDATA
2022/09/22 11:34:00 CachePath duration: 0s, args: 
2022/09/22 11:34:00 Flags duration: 0s, args:
JanDeDobbeleer commented 2 years ago

@GavinOsborn this is possibly right. The segment was created by a contributor and probably only used a unix environment. I'll adjust.

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