Multiple conditions in template logic #5290
Answered
by
JanDeDobbeleer
Schweber
asked this question in
Troubleshoot
Replies: 1 comment 1 reply
-
template = "{{ if and (ne \"Charging\" .State.String) (not .Error) }} {{ .Percentage }} {{ end }}" |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Schweber
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like the battery segment to only show if there are no errors and the battery is not charging. However, i'm struggling with the logic system of
oh-my-posh
and have only found a way to implement one condition because i don't understand if and how i can employ theand
keyword together with other keywords forif
.The following works but i don't know how i can add
not .Error
to it so that both conditions are checked:template = " {{ if ne \"Charging\" .State.String }} {{ .Percentage }}{{ end }} "
How can i combine both conditions into one clause?
Beta Was this translation helpful? Give feedback.
All reactions