summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-04-20 18:53:40 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-04-20 18:57:08 +1000
commitf05a5e531ee8271e0232db7f3bb7202ea550656e (patch)
tree5a534f14851a30b88d8b436255859b64c21ee23c
parent68586ec49a3316db4d5685e8cbbb0e4b1b540d66 (diff)
warnings for stash actionsv0.20
-rw-r--r--docs/Config.md1
-rw-r--r--pkg/config/app_config.go1
-rw-r--r--pkg/gui/stash_panel.go32
-rw-r--r--pkg/i18n/english.go12
4 files changed, 44 insertions, 2 deletions
diff --git a/docs/Config.md b/docs/Config.md
index 4becd364f..15f5617d7 100644
--- a/docs/Config.md
+++ b/docs/Config.md
@@ -28,6 +28,7 @@ Default path for the config file:
show: true
mouseEvents: true
skipUnstageLineWarning: false
+ skipStashWarning: true
git:
paging:
colorArg: always
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go
index f3824c5f1..a36512ee1 100644
--- a/pkg/config/app_config.go
+++ b/pkg/config/app_config.go
@@ -244,6 +244,7 @@ func GetDefaultConfig() []byte {
scrollPastBottom: true
mouseEvents: true
skipUnstageLineWarning: false
+ skipStashWarning: true
sidePanelWidth: 0.3333
theme:
lightTheme: false
diff --git a/pkg/gui/stash_panel.go b/pkg/gui/stash_panel.go
index cc368be66..a6f2d0b48 100644
--- a/pkg/gui/stash_panel.go
+++ b/pkg/gui/stash_panel.go
@@ -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 {
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index fa5a3ba65..6bca0589d 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -379,6 +379,18 @@ func addEnglish(i18nObject *i18n.Bundle) error {
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}}",
}, &i18n.Message{