1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Remove return value of Alert/Confirm/Prompt

This might seem controversial; in many cases the client code gets longer,
because it needs an extra line for an explicit `return nil`. I still prefer
this, because it makes it clearer which calls can return errors.
This commit is contained in:
Stefan Haller
2024-09-05 11:10:27 +02:00
parent b15a1c7ae7
commit d4ef8e53d5
39 changed files with 303 additions and 131 deletions

View File

@ -231,7 +231,7 @@ func (self *CommitsHelper) OpenCommitMenu(suggestionFunc func(string) []*types.S
}
func (self *CommitsHelper) addCoAuthor(suggestionFunc func(string) []*types.Suggestion) error {
return self.c.Prompt(types.PromptOpts{
self.c.Prompt(types.PromptOpts{
Title: self.c.Tr.AddCoAuthorPromptTitle,
FindSuggestionsFunc: suggestionFunc,
HandleConfirm: func(value string) error {
@ -241,6 +241,8 @@ func (self *CommitsHelper) addCoAuthor(suggestionFunc func(string) []*types.Sugg
return nil
},
})
return nil
}
func (self *CommitsHelper) pasteCommitMessageFromClipboard() error {
@ -258,7 +260,7 @@ func (self *CommitsHelper) pasteCommitMessageFromClipboard() error {
}
// Confirm before overwriting the commit message
return self.c.Confirm(types.ConfirmOpts{
self.c.Confirm(types.ConfirmOpts{
Title: self.c.Tr.PasteCommitMessageFromClipboard,
Prompt: self.c.Tr.SurePasteCommitMessage,
HandleConfirm: func() error {
@ -266,4 +268,6 @@ func (self *CommitsHelper) pasteCommitMessageFromClipboard() error {
return nil
},
})
return nil
}