mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
Show warning about deprecated edit configs
We print this to the terminal after lazygit quits rather than showing it in a panel at startup, so as to not annoy people too much. Hopefully it will still be prominent enough this way.
This commit is contained in:
@ -495,6 +495,8 @@ func (gui *Gui) Run(startArgs appTypes.StartArgs) error {
|
||||
return err
|
||||
}
|
||||
|
||||
defer gui.checkForDeprecatedEditConfigs()
|
||||
|
||||
gui.g = g
|
||||
defer gui.g.Close()
|
||||
|
||||
@ -583,6 +585,37 @@ func (gui *Gui) RunAndHandleError(startArgs appTypes.StartArgs) error {
|
||||
})
|
||||
}
|
||||
|
||||
func (gui *Gui) checkForDeprecatedEditConfigs() {
|
||||
osConfig := &gui.UserConfig.OS
|
||||
deprecatedConfigs := []struct {
|
||||
config string
|
||||
oldName string
|
||||
newName string
|
||||
}{
|
||||
{osConfig.EditCommand, "EditCommand", "Edit"},
|
||||
{osConfig.EditCommandTemplate, "EditCommandTemplate", "Edit,EditAtLine"},
|
||||
{osConfig.OpenCommand, "OpenCommand", "Open"},
|
||||
{osConfig.OpenLinkCommand, "OpenLinkCommand", "OpenLink"},
|
||||
}
|
||||
deprecatedConfigStrings := []string{}
|
||||
|
||||
for _, dc := range deprecatedConfigs {
|
||||
if dc.config != "" {
|
||||
deprecatedConfigStrings = append(deprecatedConfigStrings, fmt.Sprintf(" OS.%s -> OS.%s", dc.oldName, dc.newName))
|
||||
}
|
||||
}
|
||||
if len(deprecatedConfigStrings) != 0 {
|
||||
warningMessage := utils.ResolvePlaceholderString(
|
||||
gui.c.Tr.DeprecatedEditConfigWarning,
|
||||
map[string]string{
|
||||
"configs": strings.Join(deprecatedConfigStrings, "\n"),
|
||||
},
|
||||
)
|
||||
|
||||
os.Stdout.Write([]byte(warningMessage))
|
||||
}
|
||||
}
|
||||
|
||||
// returns whether command exited without error or not
|
||||
func (gui *Gui) runSubprocessWithSuspenseAndRefresh(subprocess oscommands.ICmdObj) error {
|
||||
_, err := gui.runSubprocessWithSuspense(subprocess)
|
||||
|
Reference in New Issue
Block a user