mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
docs(templates): add context for float64 numbers in segment cache
relates to #3218
This commit is contained in:
parent
2dc8dab25b
commit
c5b7c7fbfc
|
@ -195,6 +195,15 @@ If you want to know if a specific segment is active, you can use the `.Segments.
|
||||||
"template": "{{ if .Segments.Contains \"Git\" }}\uf7d3{{ else if gt .Code 0 }}\uf00d{{ else }}\uf00c{{ end }} "
|
"template": "{{ if .Segments.Contains \"Git\" }}\uf7d3{{ else if gt .Code 0 }}\uf00d{{ else }}\uf00c{{ end }} "
|
||||||
```
|
```
|
||||||
|
|
||||||
|
:::tip
|
||||||
|
Due to the way the segments data is cached, all numbers are converted to `float64`. If you want to use a number in a
|
||||||
|
template, you need to compare it to a `float64`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
"template": "{{ if gt .Segments.Git.StashCount (float64 0) }}Stash!{{ end }}"
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|
||||||
## Text decoration
|
## Text decoration
|
||||||
|
|
||||||
You can make use of the following syntax to decorate text:
|
You can make use of the following syntax to decorate text:
|
||||||
|
|
Loading…
Reference in a new issue