docs(templates): add context for float64 numbers in segment cache

relates to #3218
This commit is contained in:
Jan De Dobbeleer 2022-12-18 12:47:25 +01:00 committed by Jan De Dobbeleer
parent 2dc8dab25b
commit c5b7c7fbfc

View file

@ -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 }} "
```
:::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
You can make use of the following syntax to decorate text: