krz/orgstar

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

Commit 9559066b0e

9559066b0e7e9c77caad36564df90f108363bd34

parent: 5e78f0d110

Verified · cmc

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

Keep the clock report's Code column title

The report matches an existing Emacs report whose heading column is titled Code.

Layout: unified · split

Sources/OrgCore/Commands/ClockReport.swift +3 −2
@@ -71,7 +71,8 @@ public enum ClockReport {
7171 }
7272
7373 /// 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.
74 /// (inclusive, `YYYY-MM-DD`), with a total after each ISO week. The heading column is
75 /// titled Code, for headings named by charge code.
7576 public static func timeReport(_ entries: [Entry], start: String? = nil, end: String? = nil) -> String {
7677 var totals: [String: [String: Int]] = [:]
7778 for entry in entries {
@@ -89,7 +90,7 @@ public enum ClockReport {
8990 let dashes7 = String(repeating: "-", count: 7)
9091 let rule: String = "|" + dashes14 + "+" + dashes47 + "+" + dashes7 + "|\n"
9192 func row(_ a: String, _ b: String, _ c: String) -> String { "| \(pad(a, 12)) | \(pad(b, 45)) | \(padLeft(c, 5)) |\n" }
92 var out = "#+title: Time Report\n\n" + row("Date", "Heading", "Hours") + rule
93 var out = "#+title: Time Report\n\n" + row("Date", "Code", "Hours") + rule
9394 var currentWeek: String?
9495 var weekMinutes = 0
9596 for (date, heading) in keys {
Tests/OrgCoreTests/ClockTests.swift −2
@@ -133,9 +133,7 @@ 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".
137136 let theirs = try Self.emacsReport(text, start: start, end: end)
138 .replacingOccurrences(of: "| Code |", with: "| Heading |")
139137 #expect(ours == theirs, "\(start ?? "-")..\(end ?? "-")\nours:\n\(ours)\ntheirs:\n\(theirs)")
140138 }
141139 }