mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
better presentation of remotes
This commit is contained in:
@ -170,9 +170,8 @@ func (c *GitCommand) GetStashEntries() []*StashEntry {
|
|||||||
|
|
||||||
func stashEntryFromLine(line string, index int) *StashEntry {
|
func stashEntryFromLine(line string, index int) *StashEntry {
|
||||||
return &StashEntry{
|
return &StashEntry{
|
||||||
Name: line,
|
Name: line,
|
||||||
Index: index,
|
Index: index,
|
||||||
DisplayString: line,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,24 +1,8 @@
|
|||||||
package commands
|
package commands
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/fatih/color"
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Remote : A git remote
|
// Remote : A git remote
|
||||||
type Remote struct {
|
type Remote struct {
|
||||||
Name string
|
Name string
|
||||||
Urls []string
|
Urls []string
|
||||||
Selected bool
|
|
||||||
Branches []*RemoteBranch
|
Branches []*RemoteBranch
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDisplayStrings returns the display string of a remote
|
|
||||||
func (r *Remote) GetDisplayStrings(isFocused bool) []string {
|
|
||||||
|
|
||||||
branchCount := len(r.Branches)
|
|
||||||
|
|
||||||
return []string{r.Name, utils.ColoredString(fmt.Sprintf("%d branches", branchCount), color.FgBlue)}
|
|
||||||
}
|
|
||||||
|
@ -2,12 +2,6 @@ package commands
|
|||||||
|
|
||||||
// StashEntry : A git stash entry
|
// StashEntry : A git stash entry
|
||||||
type StashEntry struct {
|
type StashEntry struct {
|
||||||
Index int
|
Index int
|
||||||
Name string
|
Name string
|
||||||
DisplayString string
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetDisplayStrings returns the display string of branch
|
|
||||||
func (s *StashEntry) GetDisplayStrings(isFocused bool) []string {
|
|
||||||
return []string{s.DisplayString}
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
package presentation
|
package presentation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/fatih/color"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands"
|
"github.com/jesseduffield/lazygit/pkg/commands"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetRemoteListDisplayStrings(remotes []*commands.Remote) [][]string {
|
func GetRemoteListDisplayStrings(remotes []*commands.Remote) [][]string {
|
||||||
@ -16,5 +20,7 @@ func GetRemoteListDisplayStrings(remotes []*commands.Remote) [][]string {
|
|||||||
|
|
||||||
// getRemoteDisplayStrings returns the display string of branch
|
// getRemoteDisplayStrings returns the display string of branch
|
||||||
func getRemoteDisplayStrings(r *commands.Remote) []string {
|
func getRemoteDisplayStrings(r *commands.Remote) []string {
|
||||||
return []string{r.Name}
|
branchCount := len(r.Branches)
|
||||||
|
|
||||||
|
return []string{r.Name, utils.ColoredString(fmt.Sprintf("%d branches", branchCount), color.FgBlue)}
|
||||||
}
|
}
|
||||||
|
@ -16,5 +16,5 @@ func GetStashEntryListDisplayStrings(stashEntries []*commands.StashEntry) [][]st
|
|||||||
|
|
||||||
// getStashEntryDisplayStrings returns the display string of branch
|
// getStashEntryDisplayStrings returns the display string of branch
|
||||||
func getStashEntryDisplayStrings(s *commands.StashEntry) []string {
|
func getStashEntryDisplayStrings(s *commands.StashEntry) []string {
|
||||||
return []string{s.DisplayString}
|
return []string{s.Name}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user