File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
pkg/gui/controllers/helpers Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -194,6 +194,13 @@ func (self *CommitsHelper) commitMessageContexts() []types.Context {
194194
195195func (self * CommitsHelper ) OpenCommitMenu (suggestionFunc func (string ) []* types.Suggestion ) error {
196196 menuItems := []* types.MenuItem {
197+ {
198+ Label : self .c .Tr .AddCoAuthor ,
199+ OnPress : func () error {
200+ return self .addCoAuthor (suggestionFunc )
201+ },
202+ Key : 'c' ,
203+ },
197204 {
198205 Label : self .c .Tr .OpenInEditor ,
199206 OnPress : func () error {
@@ -207,3 +214,16 @@ func (self *CommitsHelper) OpenCommitMenu(suggestionFunc func(string) []*types.S
207214 Items : menuItems ,
208215 })
209216}
217+
218+ func (self * CommitsHelper ) addCoAuthor (suggestionFunc func (string ) []* types.Suggestion ) error {
219+ return self .c .Prompt (types.PromptOpts {
220+ Title : self .c .Tr .AddCoAuthorPromptTitle ,
221+ FindSuggestionsFunc : suggestionFunc ,
222+ HandleConfirm : func (value string ) error {
223+ commitMessage := self .JoinCommitMessageAndDescription ()
224+ coAuthorString := commitMessage + "\n Co-authored-by: " + value
225+ self .SetMessageAndDescriptionInView (coAuthorString )
226+ return nil
227+ },
228+ })
229+ }
You can’t perform that action at this time.
0 commit comments