oh-my-posh/website/docs/segments/exit.mdx

54 lines
1.5 KiB
Plaintext
Raw Normal View History

2020-10-05 02:33:12 -07:00
---
id: exit
title: Exit code
sidebar_label: Exit code
---
## What
Displays the last exit code or that the last command failed based on the configuration.
## Sample Configuration
2023-03-31 11:55:36 -07:00
import Config from '@site/src/components/Config.js';
<Config data={{
2020-10-05 02:33:12 -07:00
"type": "exit",
"style": "diamond",
"foreground": "#ffffff",
"background": "#00897b",
"background_templates": ["{{ if gt .Code 0 }}#e91e63{{ end }}"],
2020-10-16 08:12:34 -07:00
"trailing_diamond": "\uE0B4",
2022-03-27 01:12:47 -07:00
"template": "<#193549>\uE0B0</> \uE23A ",
2020-10-05 02:33:12 -07:00
"properties": {
2022-03-27 01:12:47 -07:00
"always_enabled": true
2020-10-05 02:33:12 -07:00
}
2023-03-31 11:55:36 -07:00
}}/>
2020-10-05 02:33:12 -07:00
## Properties
| Name | Type | Description |
| ---------------- | --------- | -------------------------------------------- |
| `always_enabled` | `boolean` | always show the status - defaults to `false` |
2020-10-05 02:33:12 -07:00
2022-04-20 09:43:59 -07:00
[colors]: /docs/configuration/colors
2021-11-14 04:39:00 -08:00
2022-02-01 03:10:46 -08:00
## Template ([info][templates])
:::note default template
```template
2022-02-01 03:10:46 -08:00
{{ if gt .Code 0 }}\uf00d {{ .Meaning }}{{ else }}\uf42e{{ end }}
```
:::
### Properties
2021-11-14 04:39:00 -08:00
| Name | Type | Description |
| ---------- | -------- | --------------------------------------------------------------------------------------- |
| `.Code` | `number` | the last known exit code |
| `.Meaning` | `string` | the textual meaning linked to exit code (if applicable, otherwise identical to `.Code`) |
2022-01-22 10:46:56 -08:00
2022-04-20 09:43:59 -07:00
[templates]: /docs/configuration/templates