-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
GCP Segment never disabled state #2810
Comments
@GavinOsborn this isn't a bug but by design. The segment has the following template: "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Project }}{{ end }} " Changing it to this will have the behaviour you're looking for: "template": "{{ if not .Error }} {{ .Project }} {{ end }}" One could argue that should be the default template, and I agree. |
Thanks @JanDeDobbeleer for the rapid turn around as always. I have everything I need to go on - but in the interest of completeness I would still suggest that you haven't actually aligned segment behavior. Consider the following theme: {
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"newline": false,
"segments": [
{
"background": "red",
"foreground": "green",
"type": "aws",
"style": "powerline",
"powerline_symbol": "\ue0b4",
"template": " \uE7AD "
},
{
"background": "blue",
"foreground": "yellow",
"type": "gcp",
"style": "powerline",
"powerline_symbol": "\ue0b4",
"template": " \uE7B2 "
},
{
"background": "white",
"foreground": "black",
"type": "az",
"style": "powerline",
"powerline_symbol": "\ue0b4",
"template": " \ufd03 "
}
],
"type": "prompt"
}
],
"version": 2
} Were I to deploy this theme onto a workstation where nether of the I'm not going to reopen the issue - I just leave this here for your consideration. Thanks again |
@GavinOsborn fair point. The error state isn't something that exists elsewhere. I agree it doesn't make sense as if something goes wrong, the debug logs are what's needed. |
aligns the segment with az and aws, relates to #2810 BREAKING CHANGE: this removes the .Error field from the segment template which means anyone with a custom template in the gcp segment needs to remove it from their template. The new default template is: `" {{ .Project }} "`
aligns the segment with az and aws, relates to #2810 BREAKING CHANGE: this removes the .Error field from the segment template which means anyone with a custom template in the gcp segment needs to remove it from their template. The new default template is: `" {{ .Project }} "`
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. |
Code of Conduct
What happened?
Most contextual segments (kubectl, az, aws, dotnet, etc) do not render anything if they have no active context - from what I can tell from the source code (I don't really understand Go) this is toggled through the
Enabled()
function of each segment.The GCP segment behaves differently when no active context - or even when the tool isn't installed at all. The GCP segment always renders something. When testing on my workstation the default template will render the error
NO ACTIVE CONFIG FOUND
.Given the behavior of the other segments I presume this is not the desired behavior?
Theme
What OS are you seeing the problem on?
Windows
Which shell are you using?
bash, powershell
Log output
The text was updated successfully, but these errors were encountered: