subrascasse

Sub Rascasse: an iPhone dive log for Subsurface cloud storage, with a pure-Swift git client (GPL-2.0)
git clone https://git.schurger.org/subrascasse.git
Log | Files | Refs | README | LICENSE

commit 79ab276a71e232b647ab7ee0a1a6de3f27f001bb
parent d1c46c1743508748f3c786854ea99e85772240ad
Author: Jean Schurger <jean@schurger.org>
Date:   Fri, 13 Nov 2026 20:45:07 -0500

divelog-cli: apply (list of changes) and locate (site position)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7deYG3yp7VDUZJzSBkvTc

Diffstat:
MPackages/DiveKit/Sources/divelog-cli/main.swift | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/Packages/DiveKit/Sources/divelog-cli/main.swift b/Packages/DiveKit/Sources/divelog-cli/main.swift @@ -74,6 +74,26 @@ do { let check = try LogRepository(directory: directory.appendingPathComponent("relecture"), branch: account, authorName: "Sub Rascasse", authorEmail: account) _ = try await check.sync(transport: transport) describe(try await check.logbook()) + case "apply": + // Applique une liste de modifications (tableau JSON de LogChange) et l'envoie. + guard let path = arguments.dropFirst().first else { fail("fichier de modifications manquant") } + let changes = try JSONDecoder().decode([LogChange].self, from: try Data(contentsOf: URL(fileURLWithPath: path))) + for change in changes { try await repository.enqueue(change) } + let report = try await repository.sync(transport: transport) + print("envoyé : \(report.sent.count) modifications sur \(changes.count), commit \(report.head?.hex ?? "-")") + for dropped in report.dropped { print(" abandonné : \(dropped)") } + describe(try await repository.logbook()) + case "locate": + // locate "Nom du lieu" latitude longitude + let rest = Array(arguments.dropFirst()) + guard rest.count == 3, let latitude = Double(rest[1]), let longitude = Double(rest[2]) else { fail("usage : locate <lieu> <latitude> <longitude>") } + let log = try await repository.logbook() + guard let site = log.sites.values.first(where: { $0.name.compare(rest[0], options: [.caseInsensitive, .diacriticInsensitive]) == .orderedSame }) else { + fail("lieu introuvable : \(rest[0])") + } + try await repository.enqueue(.locateSite(uuid: site.uuid, latitude: latitude, longitude: longitude)) + let report = try await repository.sync(transport: transport) + print("\(site.name) : position envoyée (\(report.sent.count) modification), commit \(report.head?.hex ?? "-")") default: fail("commande inconnue : \(command)") }