mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-23 12:18:51 +02: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:
parent
e3c5e07b20
commit
046b0d9daa
@ -495,6 +495,8 @@ func (gui *Gui) Run(startArgs appTypes.StartArgs) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer gui.checkForDeprecatedEditConfigs()
|
||||||
|
|
||||||
gui.g = g
|
gui.g = g
|
||||||
defer gui.g.Close()
|
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
|
// returns whether command exited without error or not
|
||||||
func (gui *Gui) runSubprocessWithSuspenseAndRefresh(subprocess oscommands.ICmdObj) error {
|
func (gui *Gui) runSubprocessWithSuspenseAndRefresh(subprocess oscommands.ICmdObj) error {
|
||||||
_, err := gui.runSubprocessWithSuspense(subprocess)
|
_, err := gui.runSubprocessWithSuspense(subprocess)
|
||||||
|
@ -155,6 +155,7 @@ type TranslationSet struct {
|
|||||||
MergeToolTitle string
|
MergeToolTitle string
|
||||||
MergeToolPrompt string
|
MergeToolPrompt string
|
||||||
IntroPopupMessage string
|
IntroPopupMessage string
|
||||||
|
DeprecatedEditConfigWarning string
|
||||||
GitconfigParseErr string
|
GitconfigParseErr string
|
||||||
LcEditFile string
|
LcEditFile string
|
||||||
LcOpenFile string
|
LcOpenFile string
|
||||||
@ -659,6 +660,21 @@ Thanks for using lazygit! Seriously you rock. Three things to share with you:
|
|||||||
Or even just star the repo to share the love!
|
Or even just star the repo to share the love!
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const englishDeprecatedEditConfigWarning = `
|
||||||
|
### Deprecated config warning ###
|
||||||
|
|
||||||
|
The following config settings are deprecated and will be removed in a future
|
||||||
|
version:
|
||||||
|
{{configs}}
|
||||||
|
|
||||||
|
Please refer to
|
||||||
|
|
||||||
|
https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#configuring-file-editing
|
||||||
|
|
||||||
|
for up-to-date information how to configure your editor.
|
||||||
|
|
||||||
|
`
|
||||||
|
|
||||||
// exporting this so we can use it in tests
|
// exporting this so we can use it in tests
|
||||||
func EnglishTranslationSet() TranslationSet {
|
func EnglishTranslationSet() TranslationSet {
|
||||||
return TranslationSet{
|
return TranslationSet{
|
||||||
@ -805,6 +821,7 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
MergeToolTitle: "Merge tool",
|
MergeToolTitle: "Merge tool",
|
||||||
MergeToolPrompt: "Are you sure you want to open `git mergetool`?",
|
MergeToolPrompt: "Are you sure you want to open `git mergetool`?",
|
||||||
IntroPopupMessage: englishIntroPopupMessage,
|
IntroPopupMessage: englishIntroPopupMessage,
|
||||||
|
DeprecatedEditConfigWarning: englishDeprecatedEditConfigWarning,
|
||||||
GitconfigParseErr: `Gogit failed to parse your gitconfig file due to the presence of unquoted '\' characters. Removing these should fix the issue.`,
|
GitconfigParseErr: `Gogit failed to parse your gitconfig file due to the presence of unquoted '\' characters. Removing these should fix the issue.`,
|
||||||
LcEditFile: `edit file`,
|
LcEditFile: `edit file`,
|
||||||
LcOpenFile: `open file`,
|
LcOpenFile: `open file`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user