(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 | diff, err := git.GetFileDiff(file) |
| 178 | if err != nil { |
| 179 | return fileProcessedMsg{filename: file, result: "", err: err} |
| 180 | } |
| 181 | |
| 182 | commitMsg := git.GenerateCommitMessage( |
| 183 | m.cfg.ApiKey, |
| 184 | diff, |
| 185 | file, |
| 186 | m.cfg, |
| 187 | m.includeEmoji, |
| 188 | ) |
| 189 | |
| 190 | m.commitMsgs[file] = commitMsg |
| 191 | |
| 192 | return fileProcessedMsg{ |
| 193 | filename: file, |
| 194 | result: "Commit message generated", |
| 195 | err: nil, |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | func (m CommitUI) View() string { |
| 201 | var b strings.Builder |
| 202 | |
| 203 | now := time.Now().Format("15:04:05") |
| 204 | header := style.TitleStyle.Render(style.IconMoon + " Luna Commits " + style.IconAngleRight + " " + now) |
| 205 |
no test coverage detected