fix(migration): do not export Enabled field in a segment

This commit is contained in:
L. Yeung 2022-05-10 10:10:01 +08:00 committed by Jan De Dobbeleer
parent 2d90ce7cbe
commit bf7bca4764
5 changed files with 93 additions and 132 deletions

View file

@ -30,7 +30,7 @@ type Segment struct {
Properties properties.Map `json:"properties,omitempty"`
writer SegmentWriter
Enabled bool
Enabled bool `json:"-"`
text string
env environment.Environment
backgroundCache string

View file

@ -8,10 +8,8 @@
"background": "p:session",
"foreground": "p:white",
"leading_diamond": "\ue0b6",
"properties": {
"template": " {{ .UserName }} "
},
"style": "diamond",
"template": " {{ .UserName }} ",
"trailing_diamond": "\ue0b0",
"type": "session"
},
@ -22,10 +20,10 @@
"properties": {
"folder_separator_icon": " \ue0b1 ",
"home_icon": "~",
"style": "folder",
"template": " \uf74a {{ .Path }} "
"style": "folder"
},
"style": "powerline",
"template": " \uf74a {{ .Path }} ",
"type": "path"
},
{
@ -43,10 +41,10 @@
"branch_max_length": 25,
"fetch_stash_count": true,
"fetch_status": true,
"fetch_upstream_icon": true,
"template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }} "
"fetch_upstream_icon": true
},
"style": "powerline",
"template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }} ",
"trailing_diamond": "\ue0b4",
"type": "git"
},
@ -55,10 +53,10 @@
"foreground": "p:white",
"powerline_symbol": "\ue0b0",
"properties": {
"fetch_version": true,
"template": " \uf898 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} "
"fetch_version": true
},
"style": "powerline",
"template": " \uf898 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ",
"type": "node"
},
{
@ -66,10 +64,10 @@
"foreground": "p:black",
"powerline_symbol": "\ue0b0",
"properties": {
"fetch_version": true,
"template": " \ue626 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
"fetch_version": true
},
"style": "powerline",
"template": " \ue626 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "go"
},
{
@ -77,10 +75,10 @@
"foreground": "p:black",
"powerline_symbol": "\ue0b0",
"properties": {
"fetch_version": true,
"template": " \ue624 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
"fetch_version": true
},
"style": "powerline",
"template": " \ue624 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "julia"
},
{
@ -89,10 +87,10 @@
"powerline_symbol": "\ue0b0",
"properties": {
"display_mode": "files",
"fetch_virtual_env": false,
"template": " \ue235 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
"fetch_virtual_env": false
},
"style": "powerline",
"template": " \ue235 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "python"
},
{
@ -101,10 +99,10 @@
"powerline_symbol": "\ue0b0",
"properties": {
"display_mode": "files",
"fetch_version": true,
"template": " \ue791 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
"fetch_version": true
},
"style": "powerline",
"template": " \ue791 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "ruby"
},
{
@ -113,10 +111,10 @@
"powerline_symbol": "\ue0b0",
"properties": {
"display_mode": "files",
"fetch_version": false,
"template": " \uf0e7{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
"fetch_version": false
},
"style": "powerline",
"template": " \uf0e7{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "azfunc"
},
{
@ -127,30 +125,28 @@
"foreground": "p:white",
"powerline_symbol": "\ue0b0",
"properties": {
"display_default": false,
"template": " \ue7ad {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} "
"display_default": false
},
"style": "powerline",
"template": " \ue7ad {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} ",
"type": "aws"
},
{
"background": "p:root",
"foreground": "p:black",
"powerline_symbol": "\ue0b0",
"properties": {
"template": " \uf0ad "
},
"style": "powerline",
"template": " \uf0ad ",
"type": "root"
},
{
"background": "p:executiontime",
"foreground": "p:white",
"properties": {
"always_enabled": true,
"template": "<transparent>\ue0b0</> \ufbab{{ .FormattedMs }}\u2800"
"always_enabled": true
},
"style": "plain",
"template": "<transparent>\ue0b0</> \ufbab{{ .FormattedMs }}\u2800",
"type": "executiontime"
},
{
@ -160,10 +156,10 @@
],
"foreground": "p:white",
"properties": {
"always_enabled": true,
"template": "<parentBackground>\ue0b0</> \ue23a "
"always_enabled": true
},
"style": "diamond",
"template": "<parentBackground>\ue0b0</> \ue23a ",
"trailing_diamond": "\ue0b4",
"type": "exit"
}
@ -175,10 +171,8 @@
{
"background": "p:shell",
"foreground": "p:white",
"properties": {
"template": "<#0077c2,transparent>\ue0b6</> \uf489 {{ .Name }} <transparent,#0077c2>\ue0b2</>"
},
"style": "plain",
"template": "<#0077c2,transparent>\ue0b6</> \uf489 {{ .Name }} <transparent,#0077c2>\ue0b2</>",
"type": "shell"
},
{
@ -188,10 +182,10 @@
"powerline_symbol": "\ue0b2",
"properties": {
"paused_icon": "\uf04c ",
"playing_icon": "\uf04b ",
"template": " \uf167 {{ .Icon }}{{ if ne .Status \"stopped\" }}{{ .Artist }} - {{ .Track }}{{ end }} "
"playing_icon": "\uf04b "
},
"style": "powerline",
"template": " \uf167 {{ .Icon }}{{ if ne .Status \"stopped\" }}{{ .Artist }} - {{ .Track }}{{ end }} ",
"type": "ytm"
},
{
@ -207,10 +201,10 @@
"properties": {
"charged_icon": "\ue22f ",
"charging_icon": "\ue234 ",
"discharging_icon": "\ue231 ",
"template": " {{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }}\uf295 "
"discharging_icon": "\ue231 "
},
"style": "powerline",
"template": " {{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }}\uf295 ",
"type": "battery"
},
{
@ -218,10 +212,8 @@
"foreground": "p:black",
"invert_powerline": true,
"leading_diamond": "\ue0b2",
"properties": {
"template": " {{ .CurrentDate | date .Format }} "
},
"style": "diamond",
"template": " {{ .CurrentDate | date .Format }} ",
"trailing_diamond": "\ue0b4",
"type": "time"
}
@ -262,5 +254,5 @@
"white": "#FFFFFF",
"ytm": "#1BD760"
},
"version": 1
"version": 2
}

View file

@ -8,10 +8,8 @@
"background": "#c386f1",
"foreground": "#ffffff",
"leading_diamond": "\ue0b6",
"properties": {
"template": " {{ .UserName }} "
},
"style": "diamond",
"template": " {{ .UserName }} ",
"trailing_diamond": "\ue0b0",
"type": "session"
},
@ -22,10 +20,10 @@
"properties": {
"folder_separator_icon": " \ue0b1 ",
"home_icon": "~",
"style": "folder",
"template": " \uf74a {{ .Path }} "
"style": "folder"
},
"style": "powerline",
"template": " \uf74a {{ .Path }} ",
"type": "path"
},
{
@ -43,10 +41,10 @@
"branch_max_length": 25,
"fetch_stash_count": true,
"fetch_status": true,
"fetch_upstream_icon": true,
"template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }} "
"fetch_upstream_icon": true
},
"style": "powerline",
"template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }} ",
"trailing_diamond": "\ue0b4",
"type": "git"
},
@ -55,10 +53,10 @@
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"properties": {
"fetch_version": true,
"template": " \uf898 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} "
"fetch_version": true
},
"style": "powerline",
"template": " \uf898 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ",
"type": "node"
},
{
@ -66,10 +64,10 @@
"foreground": "#111111",
"powerline_symbol": "\ue0b0",
"properties": {
"fetch_version": true,
"template": " \ue626 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
"fetch_version": true
},
"style": "powerline",
"template": " \ue626 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "go"
},
{
@ -77,10 +75,10 @@
"foreground": "#111111",
"powerline_symbol": "\ue0b0",
"properties": {
"fetch_version": true,
"template": " \ue624 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
"fetch_version": true
},
"style": "powerline",
"template": " \ue624 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "julia"
},
{
@ -89,10 +87,10 @@
"powerline_symbol": "\ue0b0",
"properties": {
"display_mode": "files",
"fetch_virtual_env": false,
"template": " \ue235 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
"fetch_virtual_env": false
},
"style": "powerline",
"template": " \ue235 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "python"
},
{
@ -101,10 +99,10 @@
"powerline_symbol": "\ue0b0",
"properties": {
"display_mode": "files",
"fetch_version": true,
"template": " \ue791 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
"fetch_version": true
},
"style": "powerline",
"template": " \ue791 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "ruby"
},
{
@ -113,10 +111,10 @@
"powerline_symbol": "\ue0b0",
"properties": {
"display_mode": "files",
"fetch_version": false,
"template": " \uf0e7{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
"fetch_version": false
},
"style": "powerline",
"template": " \uf0e7{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "azfunc"
},
{
@ -127,30 +125,28 @@
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"properties": {
"display_default": false,
"template": " \ue7ad {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} "
"display_default": false
},
"style": "powerline",
"template": " \ue7ad {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} ",
"type": "aws"
},
{
"background": "#ffff66",
"foreground": "#111111",
"powerline_symbol": "\ue0b0",
"properties": {
"template": " \uf0ad "
},
"style": "powerline",
"template": " \uf0ad ",
"type": "root"
},
{
"background": "#83769c",
"foreground": "#ffffff",
"properties": {
"always_enabled": true,
"template": "<transparent>\ue0b0</> \ufbab{{ .FormattedMs }}\u2800"
"always_enabled": true
},
"style": "plain",
"template": "<transparent>\ue0b0</> \ufbab{{ .FormattedMs }}\u2800",
"type": "executiontime"
},
{
@ -160,10 +156,10 @@
],
"foreground": "#ffffff",
"properties": {
"always_enabled": true,
"template": "<parentBackground>\ue0b0</> \ue23a "
"always_enabled": true
},
"style": "diamond",
"template": "<parentBackground>\ue0b0</> \ue23a ",
"trailing_diamond": "\ue0b4",
"type": "exit"
}
@ -175,10 +171,8 @@
{
"background": "#0077c2",
"foreground": "#ffffff",
"properties": {
"template": "<#0077c2,transparent>\ue0b6</> \uf489 {{ .Name }} <transparent,#0077c2>\ue0b2</>"
},
"style": "plain",
"template": "<#0077c2,transparent>\ue0b6</> \uf489 {{ .Name }} <transparent,#0077c2>\ue0b2</>",
"type": "shell"
},
{
@ -188,10 +182,10 @@
"powerline_symbol": "\ue0b2",
"properties": {
"paused_icon": "\uf04c ",
"playing_icon": "\uf04b ",
"template": " \uf167 {{ .Icon }}{{ if ne .Status \"stopped\" }}{{ .Artist }} - {{ .Track }}{{ end }} "
"playing_icon": "\uf04b "
},
"style": "powerline",
"template": " \uf167 {{ .Icon }}{{ if ne .Status \"stopped\" }}{{ .Artist }} - {{ .Track }}{{ end }} ",
"type": "ytm"
},
{
@ -207,10 +201,10 @@
"properties": {
"charged_icon": "\ue22f ",
"charging_icon": "\ue234 ",
"discharging_icon": "\ue231 ",
"template": " {{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }}\uf295 "
"discharging_icon": "\ue231 "
},
"style": "powerline",
"template": " {{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }}\uf295 ",
"type": "battery"
},
{
@ -218,10 +212,8 @@
"foreground": "#111111",
"invert_powerline": true,
"leading_diamond": "\ue0b2",
"properties": {
"template": " {{ .CurrentDate | date .Format }} "
},
"style": "diamond",
"template": " {{ .CurrentDate | date .Format }} ",
"trailing_diamond": "\ue0b4",
"type": "time"
}
@ -231,5 +223,5 @@
],
"console_title_template": "{{ .Shell }} in {{ .Folder }}",
"final_space": true,
"version": 1
"version": 2
}

View file

@ -7,94 +7,75 @@
"segments": [
{
"foreground": "#ffbebc",
"leading_diamond": "<#ff70a6>  </>",
"powerline_symbol": "",
"leading_diamond": "<#ff70a6> \ue200 </>",
"properties": {
"display_host": true,
"template": "{{ .UserName }} <#ffffff>on</>"
"display_host": true
},
"style": "diamond",
"trailing_diamond": "",
"template": "{{ .UserName }} <#ffffff>on</>",
"type": "session"
},
{
"foreground": "#bc93ff",
"leading_diamond": "",
"properties": {
"template": " {{ .CurrentDate | date .Format }} ",
"time_format": "Monday <#ffffff>at</> 3:04 PM"
},
"style": "diamond",
"trailing_diamond": "",
"template": " {{ .CurrentDate | date .Format }} ",
"type": "time"
},
{
"foreground": "#ee79d1",
"leading_diamond": "",
"properties": {
"branch_icon": "\ue725 ",
"fetch_stash_count": true,
"fetch_status": true,
"fetch_upstream_icon": true,
"fetch_worktree_count": true,
"template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }} "
"fetch_worktree_count": true
},
"style": "diamond",
"trailing_diamond": "",
"template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }} ",
"type": "git"
}
],
"type": "prompt"
},
{
"alignment": "right",
"newline": false,
"segments": [
{
"foreground": "#a9ffb4",
"properties": {
"template": ""
},
"style": "plain",
"type": "text"
},
{
"foreground": "#a9ffb4",
"leading_diamond": "",
"properties": {
"style": "dallas",
"template": " {{ .FormattedMs }}s <#ffffff></>",
"threshold": 0
},
"style": "diamond",
"trailing_diamond": "",
"template": " {{ .FormattedMs }}s <#ffffff>\ue601</>",
"type": "executiontime"
},
{
"properties": {
"root_icon": "\uf292 ",
"template": " \uf0e7 "
"root_icon": "\uf292 "
},
"style": "diamond",
"template": " \uf0e7 ",
"type": "root"
},
{
"foreground": "#94ffa2",
"leading_diamond": "",
"properties": {
"template": " <#ffffff>CPU:</> {{ round .PhysicalPercentUsed .Precision }}% "
},
"style": "diamond",
"template": " <#ffffff>CPU:</> {{ round .PhysicalPercentUsed .Precision }}% ",
"type": "sysinfo"
},
{
"foreground": "#81ff91",
"properties": {
"template": "<#ffffff></> <#ffffff>RAM:</> {{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1000000000.0) }}/{{ (div .PhysicalTotalMemory 1000000000.0) }}GB "
},
"style": "diamond",
"trailing_diamond": "",
"template": "<#ffffff>\uf6dc</> <#ffffff>RAM:</> {{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1000000000.0) }}/{{ (div .PhysicalTotalMemory 1000000000.0) }}GB ",
"type": "sysinfo"
}
],
@ -106,34 +87,34 @@
"segments": [
{
"foreground": "#ffafd2",
"leading_diamond": "<#00c7fc> </><#ffafd2>{</>",
"leading_diamond": "<#00c7fc> \ue285 </><#ffafd2>{</>",
"properties": {
"folder_icon": "",
"folder_separator_icon": "",
"folder_icon": "\uf07b",
"folder_separator_icon": "\uf9e0",
"home_icon": "home",
"style": "agnoster_full",
"template": " \ue5ff {{ .Path }} "
"style": "agnoster_full"
},
"style": "diamond",
"template": " \ue5ff {{ .Path }} ",
"trailing_diamond": "<#ffafd2>}</>",
"type": "path"
},
{
"foreground": "#A9FFB4",
"foreground_templates": ["{{ if gt .Code 0 }}#ef5350{{ end }}"],
"foreground_templates": [
"{{ if gt .Code 0 }}#ef5350{{ end }}"
],
"properties": {
"always_enabled": true,
"template": "  "
"always_enabled": true
},
"style": "plain",
"template": " \ue286 ",
"type": "exit"
}
],
"type": "prompt"
}
],
"console_title": true,
"console_title_style": "template",
"console_title_template": "{{ .Folder }}",
"osc99": true,
"transient_prompt": {
@ -141,5 +122,5 @@
"foreground": "#FEF5ED",
"template": "\ue285 "
},
"version": 1
"version": 2
}

View file

@ -8,10 +8,8 @@
"background": "#6272a4",
"foreground": "#ffffff",
"leading_diamond": "\ue0b6",
"properties": {
"template": "{{ .UserName }} "
},
"style": "diamond",
"template": "{{ .UserName }} ",
"type": "session"
},
{
@ -19,10 +17,10 @@
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"properties": {
"style": "folder",
"template": " {{ .Path }} "
"style": "folder"
},
"style": "powerline",
"template": " {{ .Path }} ",
"type": "path"
},
{
@ -33,30 +31,28 @@
"branch_icon": "",
"fetch_stash_count": true,
"fetch_status": false,
"fetch_upstream_icon": true,
"template": " \u279c ({{ .UpstreamIcon }}{{ .HEAD }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }}) "
"fetch_upstream_icon": true
},
"style": "powerline",
"template": " \u279c ({{ .UpstreamIcon }}{{ .HEAD }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }}) ",
"type": "git"
},
{
"background": "#8be9fd",
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"properties": {
"template": " \ue718 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} "
},
"style": "powerline",
"template": " \ue718 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ",
"type": "node"
},
{
"background": "#ff79c6",
"foreground": "#ffffff",
"properties": {
"template": " \u2665 {{ .CurrentDate | date .Format }} ",
"time_format": "15:04"
},
"style": "diamond",
"template": " \u2665 {{ .CurrentDate | date .Format }} ",
"trailing_diamond": "\ue0b0",
"type": "time"
}
@ -65,5 +61,5 @@
}
],
"final_space": true,
"version": 1
"version": 2
}