Shared helpers for interacting with the kopia CLI.
Used by bestool-tamanu (for the kopia_backup doctor check) and by
bestool (for the bestool kopia subcommand suite). Has nothing
tamanu-specific in it.
Highlights:
- [
find_kopia_binary] / [find_windows_kopia_binary] / [find_windows_kopia_config]: locate kopia and (on Windows) the per-user repository config from KopiaUI's standard install locations. - [
linux_elevation]: decide whether/how to elevate to thekopiasystem user on Linux. Returns [Elevation::Sudo] when we're not the kopia user and the system kopia install is present, [Elevation::Direct] when we already have access, [Elevation::Skip] otherwise. - [
Snapshot] and [fetch_snapshots]: deserialisekopia snapshot list --jsonoutput into a typed shape. - [
SnapshotFilter] / [build_filter]: in-process filtering of a snapshot list by host, tag, path substring, and time window. - With the
clifeature: [SnapshotSelectorArgs] (aclap::Args-derived struct that consumer commands flatten into their own args) and [select_snapshot] (adialoguer-backed interactive picker).