mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
parent
4c6cb5ad3d
commit
adf97352d0
|
@ -55,6 +55,7 @@ func toggleFeature(cmd *cobra.Command, feature string, enable bool) {
|
||||||
env.Cache().Delete(upgrade.CACHEKEY)
|
env.Cache().Delete(upgrade.CACHEKEY)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
env.Cache().Set(upgrade.CACHEKEY, "disabled", -1)
|
env.Cache().Set(upgrade.CACHEKEY, "disabled", -1)
|
||||||
default:
|
default:
|
||||||
_ = cmd.Help()
|
_ = cmd.Help()
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"github.com/jandedobbeleer/oh-my-posh/src/engine"
|
"github.com/jandedobbeleer/oh-my-posh/src/engine"
|
||||||
"github.com/jandedobbeleer/oh-my-posh/src/platform"
|
"github.com/jandedobbeleer/oh-my-posh/src/platform"
|
||||||
"github.com/jandedobbeleer/oh-my-posh/src/shell"
|
"github.com/jandedobbeleer/oh-my-posh/src/shell"
|
||||||
|
"github.com/jandedobbeleer/oh-my-posh/src/upgrade"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -63,11 +64,14 @@ func runInit(shellName string) {
|
||||||
}
|
}
|
||||||
env.Init()
|
env.Init()
|
||||||
defer env.Close()
|
defer env.Close()
|
||||||
|
|
||||||
cfg := engine.LoadConfig(env)
|
cfg := engine.LoadConfig(env)
|
||||||
|
|
||||||
shell.Transient = cfg.TransientPrompt != nil
|
shell.Transient = cfg.TransientPrompt != nil
|
||||||
shell.ErrorLine = cfg.ErrorLine != nil || cfg.ValidLine != nil
|
shell.ErrorLine = cfg.ErrorLine != nil || cfg.ValidLine != nil
|
||||||
shell.Tooltips = len(cfg.Tooltips) > 0
|
shell.Tooltips = len(cfg.Tooltips) > 0
|
||||||
shell.ShellIntegration = cfg.ShellIntegration
|
shell.ShellIntegration = cfg.ShellIntegration
|
||||||
|
|
||||||
for i, block := range cfg.Blocks {
|
for i, block := range cfg.Blocks {
|
||||||
// only fetch cursor position when relevant
|
// only fetch cursor position when relevant
|
||||||
if !cfg.DisableCursorPositioning && (i == 0 && block.Newline) {
|
if !cfg.DisableCursorPositioning && (i == 0 && block.Newline) {
|
||||||
|
@ -77,11 +81,18 @@ func runInit(shellName string) {
|
||||||
shell.RPrompt = true
|
shell.RPrompt = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// allow overriding the upgrade notice from the config
|
||||||
|
if cfg.DisableNotice {
|
||||||
|
env.Cache().Set(upgrade.CACHEKEY, "disabled", -1)
|
||||||
|
}
|
||||||
|
|
||||||
if printOutput {
|
if printOutput {
|
||||||
init := shell.PrintInit(env)
|
init := shell.PrintInit(env)
|
||||||
fmt.Print(init)
|
fmt.Print(init)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
init := shell.Init(env)
|
init := shell.Init(env)
|
||||||
fmt.Print(init)
|
fmt.Print(init)
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ type Config struct {
|
||||||
Var map[string]any `json:"var,omitempty" toml:"var,omitempty"`
|
Var map[string]any `json:"var,omitempty" toml:"var,omitempty"`
|
||||||
DisableCursorPositioning bool `json:"disable_cursor_positioning,omitempty" toml:"disable_cursor_positioning,omitempty"`
|
DisableCursorPositioning bool `json:"disable_cursor_positioning,omitempty" toml:"disable_cursor_positioning,omitempty"`
|
||||||
PatchPwshBleed bool `json:"patch_pwsh_bleed,omitempty" toml:"patch_pwsh_bleed,omitempty"`
|
PatchPwshBleed bool `json:"patch_pwsh_bleed,omitempty" toml:"patch_pwsh_bleed,omitempty"`
|
||||||
|
DisableNotice bool `json:"disable_notice,omitempty" toml:"disable_notice,omitempty"`
|
||||||
|
|
||||||
// Deprecated
|
// Deprecated
|
||||||
OSC99 bool `json:"osc99,omitempty" toml:"osc99,omitempty"`
|
OSC99 bool `json:"osc99,omitempty" toml:"osc99,omitempty"`
|
||||||
|
|
|
@ -59,15 +59,16 @@ func Latest(env platform.Environment) (string, error) {
|
||||||
//
|
//
|
||||||
// The upgrade check is only performed every other week.
|
// The upgrade check is only performed every other week.
|
||||||
func Notice(env platform.Environment) (string, bool) {
|
func Notice(env platform.Environment) (string, bool) {
|
||||||
// never validate when we install using the Windows Store
|
|
||||||
if env.Getenv("POSH_INSTALLER") == "ws" {
|
|
||||||
return "", false
|
|
||||||
}
|
|
||||||
// do not check when last validation was < 1 week ago
|
// do not check when last validation was < 1 week ago
|
||||||
if _, OK := env.Cache().Get(CACHEKEY); OK {
|
if _, OK := env.Cache().Get(CACHEKEY); OK {
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// never validate when we install using the Windows Store
|
||||||
|
if env.Getenv("POSH_INSTALLER") == "ws" {
|
||||||
|
return "", false
|
||||||
|
}
|
||||||
|
|
||||||
latest, err := Latest(env)
|
latest, err := Latest(env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", false
|
return "", false
|
||||||
|
|
|
@ -4449,6 +4449,18 @@
|
||||||
"description": "https://ohmyposh.dev/docs/configuration/general#general-settings",
|
"description": "https://ohmyposh.dev/docs/configuration/general#general-settings",
|
||||||
"default": ""
|
"default": ""
|
||||||
},
|
},
|
||||||
|
"disable_notice": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Disable Upgrade Notice",
|
||||||
|
"description": "https://ohmyposh.dev/docs/configuration/title#general-settings",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"patch_pwsh_bleed": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Patch PowerShell Color Bleed",
|
||||||
|
"description": "https://ohmyposh.dev/docs/configuration/title#general-settings",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
"console_title_template": {
|
"console_title_template": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"title": "Console Title Template",
|
"title": "Console Title Template",
|
||||||
|
|
|
@ -136,6 +136,7 @@ For example, the following is a valid `--config` flag:
|
||||||
| `shell_integration` | `boolean` | enable shell integration using FinalTerm's OSC sequences. Works in bash, cmd (Clink v1.14.25+), fish, powershell and zsh |
|
| `shell_integration` | `boolean` | enable shell integration using FinalTerm's OSC sequences. Works in bash, cmd (Clink v1.14.25+), fish, powershell and zsh |
|
||||||
| `disable_cursor_positioning` | `boolean` | disable fetching the cursor position in bash and zsh in case of unwanted side-effects |
|
| `disable_cursor_positioning` | `boolean` | disable fetching the cursor position in bash and zsh in case of unwanted side-effects |
|
||||||
| `patch_pwsh_bleed` | `boolean` | 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` | 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` | disable the upgrade notice |
|
||||||
|
|
||||||
### JSON Schema Validation
|
### JSON Schema Validation
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue