feat: deprecate offset properties

This commit is contained in:
Jan De Dobbeleer 2022-07-03 10:54:52 +02:00 committed by Jan De Dobbeleer
parent 2710f79613
commit 9f9b91e566
7 changed files with 19 additions and 41 deletions

View file

@ -38,13 +38,15 @@ const (
type Block struct {
Type BlockType `json:"type,omitempty"`
Alignment BlockAlignment `json:"alignment,omitempty"`
HorizontalOffset int `json:"horizontal_offset,omitempty"`
VerticalOffset int `json:"vertical_offset,omitempty"`
Segments []*Segment `json:"segments,omitempty"`
Newline bool `json:"newline,omitempty"`
Filler string `json:"filler,omitempty"`
Overflow Overflow `json:"overflow,omitempty"`
// Deprecated: keep the logic for legacy purposes
HorizontalOffset int `json:"horizontal_offset,omitempty"`
VerticalOffset int `json:"vertical_offset,omitempty"`
env environment.Environment
writer color.Writer
ansi *color.Ansi

View file

@ -2,7 +2,7 @@
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "right",
"type": "rprompt",
"segments": [
{
"foreground": "#007ACC",
@ -13,13 +13,10 @@
"template": " {{ .CurrentDate | date .Format }} ",
"type": "time"
}
],
"type": "prompt",
"vertical_offset": -1
]
},
{
"alignment": "left",
"newline": true,
"segments": [
{
"background": "#ffffff",

View file

@ -38,8 +38,7 @@
"type": "git"
}
],
"type": "prompt",
"vertical_offset": 1
"type": "prompt"
},
{
"alignment": "right",
@ -67,7 +66,7 @@
"always_enabled": true
},
"style": "plain",
"template": " {{ if gt .Code 0 }}<#ff0000>\uf00d \ue23a</>{{ else }}<#23d18b>\uf42e \ue23a</>{{ end }} ",
"template": " {{ if gt .Code 0 }}<#ff0000>\uf00d</>{{ else }}<#23d18b>\uf42e</>{{ end }} ",
"type": "exit"
},
{

View file

@ -2,7 +2,6 @@
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "right",
"segments": [
{
"foreground": "#00C5C7",
@ -14,12 +13,10 @@
"type": "time"
}
],
"type": "prompt",
"vertical_offset": -1
"type": "rprompt"
},
{
"alignment": "left",
"newline": true,
"segments": [
{
"foreground": "#77E4F7",

View file

@ -171,16 +171,6 @@
"description": "https://ohmyposh.dev/docs/configuration/block#newline",
"default": false
},
"vertical_offset": {
"type": "integer",
"title": "Block vertical offset",
"description": "https://ohmyposh.dev/docs/configuration/block#vertical-offset"
},
"horizontal-offset": {
"type": "integer",
"title": "Block vertical offset",
"description": "https://ohmyposh.dev/docs/configuration/block#horizontal-offset"
},
"segments": {
"type": "array",
"title": "Segments list, prompt elements to display based on context",

View file

@ -66,8 +66,7 @@
"type": "executiontime"
}
],
"type": "prompt",
"vertical_offset": 1
"type": "prompt"
},
{
"alignment": "left",

View file

@ -23,7 +23,6 @@ import TabItem from "@theme/TabItem"
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "right",
"segments": [
{
"foreground": "#007ACC",
@ -35,8 +34,7 @@ import TabItem from "@theme/TabItem"
"type": "time"
}
],
"type": "prompt",
"vertical_offset": -1
"type": "rprompt",
},
{
"alignment": "left",
@ -115,7 +113,7 @@ import TabItem from "@theme/TabItem"
```yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
blocks:
- alignment: right
- type: rprompt
segments:
- foreground: "#007ACC"
template: " {{ .CurrentDate | date .Format }} "
@ -123,8 +121,6 @@ blocks:
time_format: '15:04:05'
style: plain
type: time
type: prompt
vertical_offset: -1
- alignment: left
newline: true
segments:
@ -185,9 +181,7 @@ final_space = true
version = 2
[[blocks]]
alignment = "right"
type = "prompt"
vertical_offset = -1
type = "rprompt"
[[blocks.segments]]
foreground = "#007ACC"