From 7be25a105d389a262ef040133a4270f2f745d255 Mon Sep 17 00:00:00 2001 From: Ram Bhosale Date: Thu, 17 Mar 2022 17:43:03 +1100 Subject: allow skipping confirmation prompt after opening subprocess --- docs/Config.md | 1 + pkg/config/user_config.go | 22 ++++++++++++---------- pkg/gui/gui.go | 6 ++++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/docs/Config.md b/docs/Config.md index 7134d1b8b..aac7f0349 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -95,6 +95,7 @@ confirmOnQuit: false quitOnTopLevelReturn: false disableStartupPopups: false notARepository: 'prompt' # one of: 'prompt' | 'create' | 'skip' +promptToReturnFromSubprocess: true # display confirmation when subprocess terminates keybinding: universal: quit: 'q' diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 3b4e0f139..ac8a2bbc1 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -11,11 +11,12 @@ type UserConfig struct { QuitOnTopLevelReturn bool `yaml:"quitOnTopLevelReturn"` Keybinding KeybindingConfig `yaml:"keybinding"` // OS determines what defaults are set for opening files and links - OS OSConfig `yaml:"os,omitempty"` - DisableStartupPopups bool `yaml:"disableStartupPopups"` - CustomCommands []CustomCommand `yaml:"customCommands"` - Services map[string]string `yaml:"services"` - NotARepository string `yaml:"notARepository"` + OS OSConfig `yaml:"os,omitempty"` + DisableStartupPopups bool `yaml:"disableStartupPopups"` + CustomCommands []CustomCommand `yaml:"customCommands"` + Services map[string]string `yaml:"services"` + NotARepository string `yaml:"notARepository"` + PromptToReturnFromSubprocess bool `yaml:"promptToReturnFromSubprocess"` } type RefresherConfig struct { @@ -535,10 +536,11 @@ func GetDefaultConfig() *UserConfig { BulkMenu: "b", }, }, - OS: GetPlatformDefaultConfig(), - DisableStartupPopups: false, - CustomCommands: []CustomCommand(nil), - Services: map[string]string(nil), - NotARepository: "prompt", + OS: GetPlatformDefaultConfig(), + DisableStartupPopups: false, + CustomCommands: []CustomCommand(nil), + Services: map[string]string(nil), + NotARepository: "prompt", + PromptToReturnFromSubprocess: true, } } diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index e5bcd3c88..c6dbf1f65 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -675,8 +675,10 @@ func (gui *Gui) runSubprocess(cmdObj oscommands.ICmdObj) error { //nolint:unpara subprocess.Stderr = ioutil.Discard subprocess.Stdin = nil - fmt.Fprintf(os.Stdout, "\n%s\n", style.FgGreen.Sprint(gui.Tr.PressEnterToReturn)) - fmt.Scanln() // wait for enter press + if gui.Config.GetUserConfig().PromptToReturnFromSubprocess { + fmt.Fprintf(os.Stdout, "\n%s", style.FgGreen.Sprint(gui.Tr.PressEnterToReturn)) + fmt.Scanln() // wait for enter press + } return err } -- cgit v1.2.3