mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 21:05:48 +02:00
add description field to ListItem interface
This commit is contained in:
parent
63209ef71e
commit
8da93fd762
9 changed files with 36 additions and 4 deletions
|
@ -20,3 +20,7 @@ func (b *Branch) RefName() string {
|
||||||
func (b *Branch) ID() string {
|
func (b *Branch) ID() string {
|
||||||
return b.RefName()
|
return b.RefName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Branch) Description() string {
|
||||||
|
return b.RefName()
|
||||||
|
}
|
||||||
|
|
|
@ -21,10 +21,6 @@ func (c *Commit) ShortSha() string {
|
||||||
return c.Sha[:8]
|
return c.Sha[:8]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Commit) NameWithSha() string {
|
|
||||||
return fmt.Sprintf("%s %s", c.Sha[:7], c.Name)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Commit) RefName() string {
|
func (c *Commit) RefName() string {
|
||||||
return c.Sha
|
return c.Sha
|
||||||
}
|
}
|
||||||
|
@ -32,3 +28,7 @@ func (c *Commit) RefName() string {
|
||||||
func (c *Commit) ID() string {
|
func (c *Commit) ID() string {
|
||||||
return c.RefName()
|
return c.RefName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Commit) Description() string {
|
||||||
|
return fmt.Sprintf("%s %s", c.Sha[:7], c.Name)
|
||||||
|
}
|
||||||
|
|
|
@ -11,3 +11,7 @@ type CommitFile struct {
|
||||||
func (f *CommitFile) ID() string {
|
func (f *CommitFile) ID() string {
|
||||||
return f.Name
|
return f.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *CommitFile) Description() string {
|
||||||
|
return f.Name
|
||||||
|
}
|
||||||
|
|
|
@ -40,3 +40,7 @@ func (f *File) Matches(f2 *File) bool {
|
||||||
func (f *File) ID() string {
|
func (f *File) ID() string {
|
||||||
return f.Name
|
return f.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *File) Description() string {
|
||||||
|
return f.Name
|
||||||
|
}
|
||||||
|
|
|
@ -14,3 +14,7 @@ func (r *Remote) RefName() string {
|
||||||
func (r *Remote) ID() string {
|
func (r *Remote) ID() string {
|
||||||
return r.RefName()
|
return r.RefName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Remote) Description() string {
|
||||||
|
return r.RefName()
|
||||||
|
}
|
||||||
|
|
|
@ -17,3 +17,7 @@ func (r *RemoteBranch) RefName() string {
|
||||||
func (r *RemoteBranch) ID() string {
|
func (r *RemoteBranch) ID() string {
|
||||||
return r.RefName()
|
return r.RefName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *RemoteBranch) Description() string {
|
||||||
|
return r.RefName()
|
||||||
|
}
|
||||||
|
|
|
@ -15,3 +15,7 @@ func (s *StashEntry) RefName() string {
|
||||||
func (s *StashEntry) ID() string {
|
func (s *StashEntry) ID() string {
|
||||||
return s.RefName()
|
return s.RefName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *StashEntry) Description() string {
|
||||||
|
return s.RefName() + ": " + s.Name
|
||||||
|
}
|
||||||
|
|
|
@ -12,3 +12,7 @@ func (t *Tag) RefName() string {
|
||||||
func (t *Tag) ID() string {
|
func (t *Tag) ID() string {
|
||||||
return t.RefName()
|
return t.RefName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Tag) Description() string {
|
||||||
|
return "tag " + t.Name
|
||||||
|
}
|
||||||
|
|
|
@ -33,7 +33,11 @@ type ListContext struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ListItem interface {
|
type ListItem interface {
|
||||||
|
// ID is a SHA when the item is a commit, a filename when the item is a file, 'stash@{4}' when it's a stash entry, 'my_branch' when it's a branch
|
||||||
ID() string
|
ID() string
|
||||||
|
|
||||||
|
// Description is something we would show in a message e.g. '123as14: push blah' for a commit
|
||||||
|
Description() string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (lc *ListContext) GetSelectedItem() ListItem {
|
func (lc *ListContext) GetSelectedItem() ListItem {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue