(m CommitUI)
| 167 | } |
| 168 | |
| 169 | func processNextFile(m CommitUI) tea.Cmd { |
| 170 | if m.currentFile >= len(m.files) { |
| 171 | return nil |
| 172 | } |
| 173 | |
| 174 | file := m.files[m.currentFile] |
| 175 | |
| 176 | return func() tea.Msg { |
| 177 | if git.ShouldIgnoreFile(file, m.cfg) { |
| 178 | return fileProcessedMsg{filename: file, result: "Ignored", err: nil} |
| 179 | } |
| 180 | |
| 181 | diff, err := git.GetFileDiff(file) |
| 182 | if err != nil { |
| 183 | return fileProcessedMsg{filename: file, result: "", err: err} |
| 184 | } |
| 185 | |
| 186 | commitMsg := git.GenerateCommitMessage( |
| 187 | m.cfg.ApiKey, |
| 188 | diff, |
| 189 | file, |
| 190 | m.cfg, |
| 191 | m.includeEmoji, |
| 192 | ) |
| 193 | |
| 194 | m.commitMsgs[file] = commitMsg |
| 195 | |
| 196 | return fileProcessedMsg{ |
| 197 | filename: file, |
| 198 | result: "Commit message generated", |
| 199 | err: nil, |
| 200 | } |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | func (m CommitUI) View() string { |
| 205 | var b strings.Builder |
no test coverage detected