feat(notice): disable upgrade notice by default

BREAKING CHANGE: changes `disable_notice: false` to `upgrade_notice`: true
This commit is contained in:
Jan De Dobbeleer 2024-09-16 08:43:29 +02:00
parent c7443123f8
commit ea50f855f8
6 changed files with 6 additions and 28 deletions

View file

@ -40,7 +40,7 @@ type Config struct {
Blocks []*Block `json:"blocks,omitempty" toml:"blocks,omitempty"` Blocks []*Block `json:"blocks,omitempty" toml:"blocks,omitempty"`
Tooltips []*Segment `json:"tooltips,omitempty" toml:"tooltips,omitempty"` Tooltips []*Segment `json:"tooltips,omitempty" toml:"tooltips,omitempty"`
Version int `json:"version" toml:"version"` 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"` AutoUpgrade bool `json:"auto_upgrade,omitempty" toml:"auto_upgrade,omitempty"`
ShellIntegration bool `json:"shell_integration,omitempty" toml:"shell_integration,omitempty"` ShellIntegration bool `json:"shell_integration,omitempty" toml:"shell_integration,omitempty"`
MigrateGlyphs bool `json:"-" toml:"-"` MigrateGlyphs bool `json:"-" toml:"-"`
@ -96,7 +96,7 @@ func (cfg *Config) Features() shell.Features {
feats = append(feats, shell.FTCSMarks) feats = append(feats, shell.FTCSMarks)
} }
if !cfg.AutoUpgrade && !cfg.DisableNotice { if cfg.UpgradeNotice && !cfg.AutoUpgrade {
feats = append(feats, shell.Notice) feats = append(feats, shell.Notice)
} }

View file

@ -91,7 +91,5 @@ func loadConfig(env runtime.Environment) *Config {
return Default(env, true) return Default(env, true)
} }
setDisableNotice(data, &cfg)
return &cfg return &cfg
} }

View file

@ -1,5 +0,0 @@
//go:build !disablenotice
package config
func setDisableNotice(_ []byte, _ *Config) {}

View file

@ -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))
}

View file

@ -4748,9 +4748,9 @@
"description": "https://ohmyposh.dev/docs/configuration/general#general-settings", "description": "https://ohmyposh.dev/docs/configuration/general#general-settings",
"default": "" "default": ""
}, },
"disable_notice": { "upgrade_notice": {
"type": "boolean", "type": "boolean",
"title": "Disable Upgrade Notice", "title": "Enable Upgrade Notice",
"description": "https://ohmyposh.dev/docs/configuration/general#general-settings", "description": "https://ohmyposh.dev/docs/configuration/general#general-settings",
"default": false "default": false
}, },

View file

@ -136,7 +136,7 @@ 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 | | `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 | | `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) | | `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 | | `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) | | `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:<ul><li>`prompt_mark`: add the `iterm2_prompt_mark` [function][iterm2-si] for supported shells</li><li>`current_dir`: expose the current directory for iTerm2</li><li>`remote_host`: expose the current remote and user for iTerm2</li></ul> | | `iterm_features` | `[]string` | `false` | enable iTerm2 specific features:<ul><li>`prompt_mark`: add the `iterm2_prompt_mark` [function][iterm2-si] for supported shells</li><li>`current_dir`: expose the current directory for iTerm2</li><li>`remote_host`: expose the current remote and user for iTerm2</li></ul> |