1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-28 09:08:41 +02:00

warnings for stash actions

This commit is contained in:
Jesse Duffield 2020-04-20 18:53:40 +10:00
parent 68586ec49a
commit f05a5e531e
4 changed files with 44 additions and 2 deletions

View File

@ -28,6 +28,7 @@ Default path for the config file:
show: true
mouseEvents: true
skipUnstageLineWarning: false
skipStashWarning: true
git:
paging:
colorArg: always

View File

@ -244,6 +244,7 @@ func GetDefaultConfig() []byte {
scrollPastBottom: true
mouseEvents: true
skipUnstageLineWarning: false
skipStashWarning: true
sidePanelWidth: 0.3333
theme:
lightTheme: false

View File

@ -66,11 +66,39 @@ func (gui *Gui) refreshStashEntries(g *gocui.Gui) error {
// specific functions
func (gui *Gui) handleStashApply(g *gocui.Gui, v *gocui.View) error {
return gui.stashDo(g, v, "apply")
skipStashWarning := gui.Config.GetUserConfig().GetBool("gui.skipStashWarning")
apply := func() error {
return gui.stashDo(g, v, "apply")
}
if skipStashWarning {
return apply()
}
title := gui.Tr.SLocalize("StashApply")
message := gui.Tr.SLocalize("SureApplyStashEntry")
return gui.createConfirmationPanel(g, v, true, title, message, func(g *gocui.Gui, v *gocui.View) error {
return apply()
}, nil)
}
func (gui *Gui) handleStashPop(g *gocui.Gui, v *gocui.View) error {
return gui.stashDo(g, v, "pop")
skipStashWarning := gui.Config.GetUserConfig().GetBool("gui.skipStashWarning")
pop := func() error {
return gui.stashDo(g, v, "pop")
}
if skipStashWarning {
return pop()
}
title := gui.Tr.SLocalize("StashPop")
message := gui.Tr.SLocalize("SurePopStashEntry")
return gui.createConfirmationPanel(g, v, true, title, message, func(g *gocui.Gui, v *gocui.View) error {
return pop()
}, nil)
}
func (gui *Gui) handleStashDrop(g *gocui.Gui, v *gocui.View) error {

View File

@ -378,6 +378,18 @@ func addEnglish(i18nObject *i18n.Bundle) error {
}, &i18n.Message{
ID: "SureDropStashEntry",
Other: "Are you sure you want to drop this stash entry?",
}, &i18n.Message{
ID: "StashPop",
Other: "Stash pop",
}, &i18n.Message{
ID: "SurePopStashEntry",
Other: "Are you sure you want to pop this stash entry?",
}, &i18n.Message{
ID: "StashApply",
Other: "Stash apply",
}, &i18n.Message{
ID: "SureApplyStashEntry",
Other: "Are you sure you want to apply this stash entry?",
}, &i18n.Message{
ID: "NoStashTo",
Other: "No stash to {{.method}}",