mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 04:54:03 -08:00
docs: how to hide segments
This commit is contained in:
parent
0e1c0fb7b2
commit
403a0b2fb5
|
@ -41,6 +41,28 @@ You can make use of the following syntax to decorate text:
|
|||
|
||||
This can be used in templates and icons/text inside your config.
|
||||
|
||||
## Hidings segments
|
||||
|
||||
To hide a whole segment including the leading and trailing symbol based on a template, the template must render into
|
||||
an empty string. This can be achieved with conditional statements (`if`). The example below will render a diamond
|
||||
segment, only if the environment variable `POSH_ENV` is not empty.
|
||||
|
||||
Only spaces are excluded, meaning you can still add line breaks and tabs if that is something you're after.
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "text",
|
||||
"style": "diamond",
|
||||
"leading_diamond": " \ue0b6",
|
||||
"trailing_diamond": "\ue0b4",
|
||||
"foreground": "#ffffff",
|
||||
"background": "#d53c14",
|
||||
"properties": {
|
||||
"template": "{{ if .Env.POSH_ENV }} \uf8c5 {{ .Env.POSH_ENV }} {{ end }}"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
[terminal-list-hyperlinks]: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
|
||||
[path-segment]: /docs/path
|
||||
[git-segment]: /docs/git
|
||||
|
|
Loading…
Reference in a new issue