diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-22 09:01:14 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 14:29:18 +1000 |
commit | 0ac402792bd184965441b6ac60d054ae7d0afd7b (patch) | |
tree | 6f41ef089c81ed2aeaab7e5824c11cc2f5defbbb /pkg/commands | |
parent | 974c6510b8fbda23b79f365efb18f2091cd757a6 (diff) |
allow getting the current item generically
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/branch.go | 4 | ||||
-rw-r--r-- | pkg/commands/commit.go | 4 | ||||
-rw-r--r-- | pkg/commands/commit_file.go | 4 | ||||
-rw-r--r-- | pkg/commands/remote.go | 4 | ||||
-rw-r--r-- | pkg/commands/remote_branch.go | 4 | ||||
-rw-r--r-- | pkg/commands/stash_entry.go | 4 | ||||
-rw-r--r-- | pkg/commands/tag.go | 4 |
7 files changed, 28 insertions, 0 deletions
diff --git a/pkg/commands/branch.go b/pkg/commands/branch.go index 27ac548a8..b182b8b6d 100644 --- a/pkg/commands/branch.go +++ b/pkg/commands/branch.go @@ -16,3 +16,7 @@ type Branch struct { func (b *Branch) RefName() string { return b.Name } + +func (b *Branch) ID() string { + return b.RefName() +} diff --git a/pkg/commands/commit.go b/pkg/commands/commit.go index 1058e8ec6..c0483f3f0 100644 --- a/pkg/commands/commit.go +++ b/pkg/commands/commit.go @@ -28,3 +28,7 @@ func (c *Commit) NameWithSha() string { func (c *Commit) RefName() string { return c.Sha } + +func (c *Commit) ID() string { + return c.RefName() +} diff --git a/pkg/commands/commit_file.go b/pkg/commands/commit_file.go index a2cf6eb20..2b231e079 100644 --- a/pkg/commands/commit_file.go +++ b/pkg/commands/commit_file.go @@ -7,3 +7,7 @@ type CommitFile struct { DisplayString string Status int // one of 'WHOLE' 'PART' 'NONE' } + +func (f *CommitFile) ID() string { + return f.Name +} diff --git a/pkg/commands/remote.go b/pkg/commands/remote.go index 264e6a2c4..17ed8c1ca 100644 --- a/pkg/commands/remote.go +++ b/pkg/commands/remote.go @@ -10,3 +10,7 @@ type Remote struct { func (r *Remote) RefName() string { return r.Name } + +func (r *Remote) ID() string { + return r.RefName() +} diff --git a/pkg/commands/remote_branch.go b/pkg/commands/remote_branch.go index 0c7352d06..656546815 100644 --- a/pkg/commands/remote_branch.go +++ b/pkg/commands/remote_branch.go @@ -13,3 +13,7 @@ func (r *RemoteBranch) FullName() string { func (r *RemoteBranch) RefName() string { return r.FullName() } + +func (r *RemoteBranch) ID() string { + return r.RefName() +} diff --git a/pkg/commands/stash_entry.go b/pkg/commands/stash_entry.go index eb70693ef..487da0f00 100644 --- a/pkg/commands/stash_entry.go +++ b/pkg/commands/stash_entry.go @@ -11,3 +11,7 @@ type StashEntry struct { func (s *StashEntry) RefName() string { return fmt.Sprintf("stash@{%d}", s.Index) } + +func (s *StashEntry) ID() string { + return s.RefName() +} diff --git a/pkg/commands/tag.go b/pkg/commands/tag.go index 71a250c40..2009472b2 100644 --- a/pkg/commands/tag.go +++ b/pkg/commands/tag.go @@ -8,3 +8,7 @@ type Tag struct { func (t *Tag) RefName() string { return t.Name } + +func (t *Tag) ID() string { + return t.RefName() +} |