diff --git a/Sources/Command.swift b/Sources/Command.swift index 5c624c4..5db0e69 100644 --- a/Sources/Command.swift +++ b/Sources/Command.swift @@ -157,7 +157,7 @@ struct Command: AsyncParsableCommand { print("Checking \(url)...") let oldSnapshot = oldState.snapshots[url] ?? State.Snapshot() let changes = snapshot.changes(from: oldSnapshot) - report.folders.append(KeyedChanges(name: url.path, url: url, changes: changes)) + report.folders.append(KeyedChanges(url: url, changes: changes)) } // Return early if there are no outstanding changes. @@ -170,7 +170,7 @@ struct Command: AsyncParsableCommand { let context: [String: Any] = ["report": report] let summary = try environment.renderTemplate(string: """ {% for item in report.folders %} -{{ item.name }} +{{ item.name }} ({{ item.path }}) {{ item.changes.additions.count }} additions {% for addition in item.changes.additions %}{{ addition }}{% endfor %} @@ -187,6 +187,7 @@ struct Command: AsyncParsableCommand { {% for item in report.folders %}
{{ item.path }}
{% if item.changes.isEmpty %}No changes.
{% else %} diff --git a/Sources/Model/KeyedChanges.swift b/Sources/Model/KeyedChanges.swift index 8b871ee..efe725b 100644 --- a/Sources/Model/KeyedChanges.swift +++ b/Sources/Model/KeyedChanges.swift @@ -22,7 +22,16 @@ import Foundation struct KeyedChanges { - let name: String let url: URL let changes: Changes + let name: String + let path: String + + init(url: URL, changes: Changes) { + self.url = url + self.changes = changes + self.name = url.lastPathComponent + self.path = url.path + } + }