mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
feat(notice): disable upgrade notice by default
BREAKING CHANGE: changes `disable_notice: false` to `upgrade_notice`: true
This commit is contained in:
parent
c7443123f8
commit
ea50f855f8
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,5 @@ func loadConfig(env runtime.Environment) *Config {
|
|||
return Default(env, true)
|
||||
}
|
||||
|
||||
setDisableNotice(data, &cfg)
|
||||
|
||||
return &cfg
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
//go:build !disablenotice
|
||||
|
||||
package config
|
||||
|
||||
func setDisableNotice(_ []byte, _ *Config) {}
|
|
@ -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))
|
||||
}
|
|
@ -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
|
||||
},
|
||||
|
|
|
@ -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:<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> |
|
||||
|
||||
### JSON Schema Validation
|
||||
|
|
Loading…
Reference in a new issue