krz/orgstar

A native macOS editor for org-mode files. editor org-mode swift

Commit 3f9cb33052

3f9cb330527c344316081db3269dfc33aed649b7

parent: 82594f0cde

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-08 03:53 UTC

Describe the clock report neutrally and title its column Heading

The middle column holds heading titles.

Layout: unified · split

Sources/OrgCore/Commands/ClockReport.swift +3 −4
@@ -70,9 +70,8 @@ public enum ClockReport {
7070 return String(format: "%04d-W%02d", Days.date(thursday).year, Days.isoWeek(day))
7171 }
7272
73 /// The time report your Doom configuration writes (`tr/generate-report`): minutes per
74 /// date and heading between `start` and `end` (inclusive, `YYYY-MM-DD`), with a total
75 /// after each ISO week.
73 /// An Org table of clocked time per date and heading between `start` and `end`
74 /// (inclusive, `YYYY-MM-DD`), with a total after each ISO week.
7675 public static func timeReport(_ entries: [Entry], start: String? = nil, end: String? = nil) -> String {
7776 var totals: [String: [String: Int]] = [:]
7877 for entry in entries {
@@ -90,7 +89,7 @@ public enum ClockReport {
9089 let dashes7 = String(repeating: "-", count: 7)
9190 let rule: String = "|" + dashes14 + "+" + dashes47 + "+" + dashes7 + "|\n"
9291 func row(_ a: String, _ b: String, _ c: String) -> String { "| \(pad(a, 12)) | \(pad(b, 45)) | \(padLeft(c, 5)) |\n" }
93 var out = "#+title: Time Report\n\n" + row("Date", "Code", "Hours") + rule
92 var out = "#+title: Time Report\n\n" + row("Date", "Heading", "Hours") + rule
9493 var currentWeek: String?
9594 var weekMinutes = 0
9695 for (date, heading) in keys {
Sources/Orgstar/ClockViews.swift +1 −2
@@ -62,8 +62,7 @@ final class ClockStatusItem: NSObject {
6262 }
6363}
6464
65/// Time per day and heading, as your `tr/generate-report` writes it, for chosen files and
66/// dates.
65/// Clocked time per day and heading (`ClockReport.timeReport`) for chosen files and dates.
6766struct ClockReportView: View {
6867 let workspace: WorkspaceModel
6968 @State private var start = Calendar.current.date(byAdding: .day, value: -6, to: Date()) ?? Date()
Tests/OrgCoreTests/ClockTests.swift +2
@@ -133,7 +133,9 @@ struct ClockReportTests {
133133 for text in texts {
134134 for (start, end) in [(nil, nil), ("2026-02-18", nil), (nil, "2026-02-20"), ("2026-02-17", "2026-02-17")] as [(String?, String?)] {
135135 let ours = ClockReport.timeReport(ClockReport.entries(text), start: start, end: end)
136 // The config titles the heading column "Code".
136137 let theirs = try Self.emacsReport(text, start: start, end: end)
138 .replacingOccurrences(of: "| Code |", with: "| Heading |")
137139 #expect(ours == theirs, "\(start ?? "-")..\(end ?? "-")\nours:\n\(ours)\ntheirs:\n\(theirs)")
138140 }
139141 }