oh-my-posh/website/docs/configuration/example.mdx
Jan De Dobbeleer f47da9592f feat(exit): implement pipestatus
BREAKING CHANGE: exit segment is now called status segment.

The exit keyword is now deprecated and will be removed in a future
release. Please use the status keyword instead:

```diff
"segments": {
    {
-     "type": "exit"
+     "type": "status"
    }
}
```

Additionally, the status segment configuration has changed to support
$PIPESTATUS. You can include a status template to customize the
rendering of each individual status code (supported in fish, zsh and
bash).

```json
"segments": {
    {
        "type": "status",
        "properties": {
            "status_template": "{{ if gt .Code 0 }}\uf071{{ else }}\uf00c{{ end }}",
            "status_separator": " "
        }
    }
}
```

In case no $PIPESTATUS is available, the status segment will fall back
to the exit code of the last command using the status template
for rendering.

The `{{ .Meaning }}` property has been marked as deprecated and can be
replaced with `{{ reason .Code }}`, allowing it to be reused in
cross segment templates.

resolves #4070
2023-07-24 11:46:33 +02:00

96 lines
2.5 KiB
Plaintext

---
id: sample
title: Sample
sidebar_label: Sample
---
import Config from '@site/src/components/Config.js';
<Config data={{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"segments": [
{
"foreground": "#007ACC",
"template": " {{ .CurrentDate | date .Format }} ",
"properties": {
"time_format": "15:04:05"
},
"style": "plain",
"type": "time"
}
],
"type": "rprompt",
},
{
"alignment": "left",
"newline": true,
"segments": [
{
"background": "#ffb300",
"foreground": "#ffffff",
"leading_diamond": "\ue0b6",
"template": " {{ .UserName }} ",
"style": "diamond",
"trailing_diamond": "\ue0b0",
"type": "session"
},
{
"background": "#61AFEF",
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"template": " {{ .Path }} ",
"properties": {
"exclude_folders": [
"/super/secret/project"
],
"style": "folder"
},
"style": "powerline",
"type": "path"
},
{
"background": "#2e9599",
"background_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}#f36943{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#a8216b{{ end }}",
"{{ if gt .Ahead 0 }}#35b5ff{{ end }}",
"{{ if gt .Behind 0 }}#f89cfa{{ end }}"
],
"foreground": "#193549",
"foreground_templates": [
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#ffffff{{ end }}"
],
"powerline_symbol": "\ue0b0",
"template": " {{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }} ",
"properties": {
"branch_max_length": 25,
"fetch_status": true
},
"style": "powerline",
"type": "git"
},
{
"background": "#00897b",
"background_templates": [
"{{ if gt .Code 0 }}#e91e63{{ end }}"
],
"foreground": "#ffffff",
"template": "<parentBackground>\ue0b0</> \ue23a ",
"properties": {
"always_enabled": true
},
"style": "diamond",
"trailing_diamond": "\ue0b4",
"type": "status"
}
],
"type": "prompt"
}
],
"final_space": true,
"version": 2
}}/>