diff options
author | Kristijan Husak <husakkristijan@gmail.com> | 2018-10-12 14:06:03 +0200 |
---|---|---|
committer | Kristijan Husak <husakkristijan@gmail.com> | 2018-10-13 22:54:51 +0200 |
commit | df0e3e52fea02950d78af5233a859f592092d475 (patch) | |
tree | 7210a491186833ca2d0481b2602add1dfa0d5e15 /pkg/gui | |
parent | d5f64602a8e10ab5c8162140d426ce677fe884ee (diff) |
Add option to create pull request form branches panel.
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/branches_panel.go | 11 | ||||
-rw-r--r-- | pkg/gui/keybindings.go | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 0f66533b1..b4ba151b5 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -22,6 +22,17 @@ func (gui *Gui) handleBranchPress(g *gocui.Gui, v *gocui.View) error { return gui.refreshSidePanels(g) } +func (gui *Gui) handleCreatePullRequestPress(g *gocui.Gui, v *gocui.View) error { + branch := gui.getSelectedBranch(gui.getBranchesView(g)) + pullRequest, _ := commands.NewPullRequest(gui.GitCommand) + + if err := pullRequest.Create(branch); err != nil { + return gui.createErrorPanel(g, err.Error()) + } + + return nil +} + func (gui *Gui) handleForceCheckout(g *gocui.Gui, v *gocui.View) error { branch := gui.getSelectedBranch(v) message := gui.Tr.SLocalize("SureForceCheckout") diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 78271a3f7..cc1edc24b 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -279,6 +279,12 @@ func (gui *Gui) GetKeybindings() []*Binding { Description: gui.Tr.SLocalize("checkout"), }, { ViewName: "branches", + Key: 'o', + Modifier: gocui.ModNone, + Handler: gui.handleCreatePullRequestPress, + Description: gui.Tr.SLocalize("createPullRequest"), + }, { + ViewName: "branches", Key: 'c', Modifier: gocui.ModNone, Handler: gui.handleCheckoutByName, |