diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-12-07 16:20:22 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-12-07 16:23:04 +1100 |
commit | 3f4613feb010fbafa405e8caa6b48e7e6bca3000 (patch) | |
tree | 49243085fc8efbb17faef420f2feeef850efc7e7 /pkg | |
parent | 033c21754b6eb5ead47a56b9dbee54a976c7fcff (diff) |
allow fetching remotes with 'f'
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/commands/git.go | 4 | ||||
-rw-r--r-- | pkg/gui/keybindings.go | 8 | ||||
-rw-r--r-- | pkg/gui/remotes_panel.go | 15 | ||||
-rw-r--r-- | pkg/i18n/english.go | 6 |
4 files changed, 33 insertions, 0 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 3464215c7..7bcc651cb 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -1109,3 +1109,7 @@ func (c *GitCommand) DeleteTag(tagName string) error { func (c *GitCommand) PushTag(remoteName string, tagName string) error { return c.OSCommand.RunCommand("git push %s %s", remoteName, tagName) } + +func (c *GitCommand) FetchRemote(remoteName string) error { + return c.OSCommand.RunCommand("git fetch %s", remoteName) +} diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 2f82bcfb9..ae0f8f8ad 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -455,6 +455,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Description: gui.Tr.SLocalize("ReturnToRemotesList"), }, { + ViewName: "branches", + Contexts: []string{"remotes"}, + Key: 'f', + Modifier: gocui.ModNone, + Handler: gui.handleFetchRemote, + Description: gui.Tr.SLocalize("fetchRemote"), + }, + { ViewName: "commits", Key: 's', Modifier: gocui.ModNone, diff --git a/pkg/gui/remotes_panel.go b/pkg/gui/remotes_panel.go index 90c2c8d59..6964bf108 100644 --- a/pkg/gui/remotes_panel.go +++ b/pkg/gui/remotes_panel.go @@ -176,3 +176,18 @@ func (gui *Gui) handleEditRemote(g *gocui.Gui, v *gocui.View) error { }) }) } + +func (gui *Gui) handleFetchRemote(g *gocui.Gui, v *gocui.View) error { + remote := gui.getSelectedRemote() + if remote == nil { + return nil + } + + return gui.WithWaitingStatus(gui.Tr.SLocalize("FetchingRemoteStatus"), func() error { + if err := gui.GitCommand.FetchRemote(remote.Name); err != nil { + return err + } + + return gui.refreshRemotes() + }) +} diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 10e4d209d..849594872 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -912,6 +912,12 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "CreateTagTitle", Other: "Tag name:", + }, &i18n.Message{ + ID: "fetchRemote", + Other: "fetch remote", + }, &i18n.Message{ + ID: "FetchingRemoteStatus", + Other: "fetching remote", }, ) } |