From ea50f855f813b89d8c546fa7d154ad82239b51eb Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 16 Sep 2024 08:43:29 +0200 Subject: [PATCH] feat(notice): disable upgrade notice by default BREAKING CHANGE: changes `disable_notice: false` to `upgrade_notice`: true --- src/config/config.go | 4 ++-- src/config/load.go | 2 -- src/config/notice_default.go | 5 ----- src/config/notice_disable.go | 15 --------------- themes/schema.json | 4 ++-- website/docs/configuration/general.mdx | 4 ++-- 6 files changed, 6 insertions(+), 28 deletions(-) delete mode 100644 src/config/notice_default.go delete mode 100644 src/config/notice_disable.go diff --git a/src/config/config.go b/src/config/config.go index c6c2194a..1deacd16 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -40,7 +40,7 @@ type Config struct { Blocks []*Block `json:"blocks,omitempty" toml:"blocks,omitempty"` Tooltips []*Segment `json:"tooltips,omitempty" toml:"tooltips,omitempty"` Version int `json:"version" toml:"version"` - DisableNotice bool `json:"disable_notice,omitempty" toml:"disable_notice,omitempty"` + UpgradeNotice bool `json:"upgrade_notice,omitempty" toml:"upgrade_notice,omitempty"` AutoUpgrade bool `json:"auto_upgrade,omitempty" toml:"auto_upgrade,omitempty"` ShellIntegration bool `json:"shell_integration,omitempty" toml:"shell_integration,omitempty"` MigrateGlyphs bool `json:"-" toml:"-"` @@ -96,7 +96,7 @@ func (cfg *Config) Features() shell.Features { feats = append(feats, shell.FTCSMarks) } - if !cfg.AutoUpgrade && !cfg.DisableNotice { + if cfg.UpgradeNotice && !cfg.AutoUpgrade { feats = append(feats, shell.Notice) } diff --git a/src/config/load.go b/src/config/load.go index 6db74c99..fd752486 100644 --- a/src/config/load.go +++ b/src/config/load.go @@ -91,7 +91,5 @@ func loadConfig(env runtime.Environment) *Config { return Default(env, true) } - setDisableNotice(data, &cfg) - return &cfg } diff --git a/src/config/notice_default.go b/src/config/notice_default.go deleted file mode 100644 index bbcc47f8..00000000 --- a/src/config/notice_default.go +++ /dev/null @@ -1,5 +0,0 @@ -//go:build !disablenotice - -package config - -func setDisableNotice(_ []byte, _ *Config) {} diff --git a/src/config/notice_disable.go b/src/config/notice_disable.go deleted file mode 100644 index 0063a588..00000000 --- a/src/config/notice_disable.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build disablenotice - -package config - -import "bytes" - -func setDisableNotice(stream []byte, cfg *Config) { - if !hasKeyInByteStream(stream, "disable_notice") { - cfg.DisableNotice = true - } -} - -func hasKeyInByteStream(data []byte, key string) bool { - return bytes.Contains(data, []byte(key)) -} diff --git a/themes/schema.json b/themes/schema.json index 95c05480..d3c705f1 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -4748,9 +4748,9 @@ "description": "https://ohmyposh.dev/docs/configuration/general#general-settings", "default": "" }, - "disable_notice": { + "upgrade_notice": { "type": "boolean", - "title": "Disable Upgrade Notice", + "title": "Enable Upgrade Notice", "description": "https://ohmyposh.dev/docs/configuration/general#general-settings", "default": false }, diff --git a/website/docs/configuration/general.mdx b/website/docs/configuration/general.mdx index 61e05f75..94237ed1 100644 --- a/website/docs/configuration/general.mdx +++ b/website/docs/configuration/general.mdx @@ -136,8 +136,8 @@ For example, the following is a valid `--config` flag: | `shell_integration` | `boolean` | `false` | enable shell integration using FinalTerm's OSC sequences. Works in bash, cmd (Clink v1.14.25+), fish, powershell and zsh | | `enable_cursor_positioning` | `boolean` | `false` | enable fetching the cursor position in bash and zsh to allow automatic hiding of leading newlines when at the top of the shell | | `patch_pwsh_bleed` | `boolean` | `false` | patch a PowerShell bug where the background colors bleed into the next line at the end of the buffer (can be removed when [this][pwsh-bleed] is merged) | -| `disable_notice` | `boolean` | `false` | disables the notice that a new upgrade is available when `auto_upgrade` is disabled | -| `auto_upgrade` | `boolean` | `false` | enable [automatic upgrades][upgrade] for Oh My Posh (supports Windows, macOS and Linux) | +| `upgrade_notice` | `boolean` | `false` | enable the notice that a new upgrade is available when `auto_upgrade` is disabled | +| `auto_upgrade` | `boolean` | `false` | enable [automatic upgrades][upgrade] for Oh My Posh (supports Windows, macOS and Linux) | | `iterm_features` | `[]string` | `false` | enable iTerm2 specific features: | ### JSON Schema Validation