diff options
author | mjarkk <mkopenga@gmail.com> | 2018-12-09 13:04:19 +0100 |
---|---|---|
committer | mjarkk <mkopenga@gmail.com> | 2018-12-09 13:04:19 +0100 |
commit | f14effe5f5d72ef5344be9d6e3057cca7c6d2c81 (patch) | |
tree | f1e1a01cce311d4989d0a9a9d52e17d7a83726b3 | |
parent | efb82a58aea920b21c6c715dc0ee37012ad4cebb (diff) |
Worked and fixed a view comments
-rw-r--r-- | pkg/commands/exec_live_default.go | 2 | ||||
-rw-r--r-- | pkg/commands/git.go | 4 | ||||
-rw-r--r-- | pkg/commands/os.go | 5 | ||||
-rw-r--r-- | pkg/config/app_config.go | 2 | ||||
-rw-r--r-- | pkg/gui/branches_panel.go | 13 | ||||
-rw-r--r-- | pkg/gui/files_panel.go | 26 |
6 files changed, 29 insertions, 23 deletions
diff --git a/pkg/commands/exec_live_default.go b/pkg/commands/exec_live_default.go index ad1c568e5..5fb84c81e 100644 --- a/pkg/commands/exec_live_default.go +++ b/pkg/commands/exec_live_default.go @@ -31,7 +31,7 @@ func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(s tty, err := pty.Start(cmd) if err != nil { - return errorMessage, err + return "", err } stopAsking := make(chan struct{}) diff --git a/pkg/commands/git.go b/pkg/commands/git.go index d9230c4eb..e708d5c55 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -261,9 +261,9 @@ func (c *GitCommand) RenameCommit(name string) error { } // Fetch fetch git repo -func (c *GitCommand) Fetch(unamePassQuestion func(string) string, canSskForCredentials bool) error { +func (c *GitCommand) Fetch(unamePassQuestion func(string) string, canAskForCredentials bool) error { return c.OSCommand.DetectUnamePass("git fetch", func(question string) string { - if canSskForCredentials { + if canAskForCredentials { return unamePassQuestion(question) } return "-" diff --git a/pkg/commands/os.go b/pkg/commands/os.go index faf6c5aec..037f6da2e 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -87,7 +87,10 @@ func (c *OSCommand) DetectUnamePass(command string, ask func(string) string) err } for askFor, prompt := range prompts { - if match, _ := regexp.MatchString(prompt.pattern, ttyText); match && prompt.canAskFor { + if !prompt.canAskFor { + continue + } + if match, _ := regexp.MatchString(prompt.pattern, ttyText); match { prompt.canAskFor = false ttyText = "" return ask(askFor) diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index 8ac886257..48cf2df35 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -245,7 +245,7 @@ func getDefaultAppState() []byte { return []byte(` lastUpdateCheck: 0 recentRepos: [] - RecentPrivateRepos: [] + recentPrivateRepos: [] `) } diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index e54d6e8c1..26b42aba2 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -136,12 +136,13 @@ func (gui *Gui) handleGitFetch(g *gocui.Gui, v *gocui.View) error { errMessage = gui.Tr.SLocalize("PassUnameWrong") } _ = gui.createErrorPanel(g, errMessage) - } - if unamePassOpend { - _, _ = g.SetViewOnBottom("pushPassUname") - _ = g.DeleteView("pushPassUname") - } - if err == nil { + if unamePassOpend { + _ = g.DeleteView("pushPassUname") + } + } else { + if unamePassOpend { + _ = g.DeleteView("pushPassUname") + } _ = gui.closeConfirmationPrompt(g) _ = gui.refreshCommits(g) _ = gui.refreshStatus(g) diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 7942e421b..127a0d96a 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -394,12 +394,13 @@ func (gui *Gui) pullFiles(g *gocui.Gui, v *gocui.View) error { errMessage = gui.Tr.SLocalize("PassUnameWrong") } _ = gui.createErrorPanel(g, errMessage) - } - if unamePassOpend { - _, _ = g.SetViewOnBottom("pushPassUname") - _ = g.DeleteView("pushPassUname") - } - if err == nil { + if unamePassOpend { + _ = g.DeleteView("pushPassUname") + } + } else { + if unamePassOpend { + _ = g.DeleteView("pushPassUname") + } _ = gui.closeConfirmationPrompt(g) _ = gui.refreshCommits(g) _ = gui.refreshStatus(g) @@ -426,12 +427,13 @@ func (gui *Gui) pushWithForceFlag(g *gocui.Gui, v *gocui.View, force bool) error errMessage = gui.Tr.SLocalize("PassUnameWrong") } _ = gui.createErrorPanel(g, errMessage) - } - if unamePassOpend { - _, _ = g.SetViewOnBottom("pushPassUname") - _ = g.DeleteView("pushPassUname") - } - if err == nil { + if unamePassOpend { + _ = g.DeleteView("pushPassUname") + } + } else { + if unamePassOpend { + _ = g.DeleteView("pushPassUname") + } _ = gui.closeConfirmationPrompt(g) _ = gui.refreshSidePanels(g) } |