mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
Replace copy SHA with copy subject on commit 'y s'
This commit is contained in:
@ -105,8 +105,21 @@ func (self *BasicCommitsController) copyCommitAttribute(commit *models.Commit) e
|
||||
OnPress: func() error {
|
||||
return self.copyCommitSHAToClipboard(commit)
|
||||
},
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitSubject,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitSubjectToClipboard(commit)
|
||||
},
|
||||
Key: 's',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitMessage,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitMessageToClipboard(commit)
|
||||
},
|
||||
Key: 'm',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitURL,
|
||||
OnPress: func() error {
|
||||
@ -121,13 +134,6 @@ func (self *BasicCommitsController) copyCommitAttribute(commit *models.Commit) e
|
||||
},
|
||||
Key: 'd',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitMessage,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitMessageToClipboard(commit)
|
||||
},
|
||||
Key: 'm',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitAuthor,
|
||||
OnPress: func() error {
|
||||
@ -211,6 +217,21 @@ func (self *BasicCommitsController) copyCommitMessageToClipboard(commit *models.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *BasicCommitsController) copyCommitSubjectToClipboard(commit *models.Commit) error {
|
||||
message, err := self.c.Git().Commit.GetCommitSubject(commit.Sha)
|
||||
if err != nil {
|
||||
return self.c.Error(err)
|
||||
}
|
||||
|
||||
self.c.LogAction(self.c.Tr.Actions.CopyCommitSubjectToClipboard)
|
||||
if err := self.c.OS().CopyToClipboard(message); err != nil {
|
||||
return self.c.Error(err)
|
||||
}
|
||||
|
||||
self.c.Toast(self.c.Tr.CommitSubjectCopiedToClipboard)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *BasicCommitsController) openInBrowser(commit *models.Commit) error {
|
||||
url, err := self.c.Helpers().Host.GetCommitURL(commit.Sha)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user