diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-17 12:02:39 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-21 22:07:14 +1100 |
commit | 6b7aaeca45847ebc41aa0fd9b773362d4a79f1ab (patch) | |
tree | d8f35e24c44a1474414cd09c76b9ae9d904c6451 /pkg/commands | |
parent | 1f3e1720a3a0bd31c0816a94d0b7c5bca1589f96 (diff) |
support adding/removing remotes
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/git.go | 8 | ||||
-rw-r--r-- | pkg/commands/remote.go | 11 |
2 files changed, 18 insertions, 1 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index ad275d10f..26f8aae32 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -1061,3 +1061,11 @@ func (c *GitCommand) BeginInteractiveRebaseForCommit(commits []*Commit, commitIn func (c *GitCommand) SetUpstreamBranch(upstream string) error { return c.OSCommand.RunCommand(fmt.Sprintf("git branch -u %s", upstream)) } + +func (c *GitCommand) AddRemote(name string, url string) error { + return c.OSCommand.RunCommand(fmt.Sprintf("git remote add %s %s", name, url)) +} + +func (c *GitCommand) RemoveRemote(name string) error { + return c.OSCommand.RunCommand(fmt.Sprintf("git remote remove %s", name)) +} diff --git a/pkg/commands/remote.go b/pkg/commands/remote.go index d61f81a53..b3c144b65 100644 --- a/pkg/commands/remote.go +++ b/pkg/commands/remote.go @@ -1,5 +1,12 @@ package commands +import ( + "fmt" + + "github.com/fatih/color" + "github.com/jesseduffield/lazygit/pkg/utils" +) + // Remote : A git remote type Remote struct { Name string @@ -11,5 +18,7 @@ type Remote struct { // GetDisplayStrings returns the display string of a remote func (r *Remote) GetDisplayStrings(isFocused bool) []string { - return []string{r.Name} + branchCount := len(r.Branches) + + return []string{r.Name, utils.ColoredString(fmt.Sprintf("%d branches", branchCount), color.FgBlue)} } |