feat: publish CodexPi contest snapshot
Some checks are pending
Qualité / tests (push) Waiting to run
Some checks are pending
Qualité / tests (push) Waiting to run
This commit is contained in:
36
scripts/storage-reconcile.py
Normal file
36
scripts/storage-reconcile.py
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "backend"))
|
||||
|
||||
from codexpi.storage_reconciliation import StorageReconciler
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Inventorie sans mutation les stockages CodexPi dupliqués."
|
||||
)
|
||||
parser.add_argument(
|
||||
"roots",
|
||||
nargs="*",
|
||||
type=Path,
|
||||
default=[Path("/home/config/CodexPi"), Path("/home/config/CodexPi2")],
|
||||
help="Racines CodexPi à comparer (deux minimum).",
|
||||
)
|
||||
parser.add_argument("--grace-days", type=int, default=14)
|
||||
parser.add_argument("--pretty", action="store_true", help="Indente le JSON de sortie.")
|
||||
args = parser.parse_args()
|
||||
report = StorageReconciler(args.roots, grace_days=args.grace_days).inventory()
|
||||
json.dump(report.public_dict(), sys.stdout, ensure_ascii=False, indent=2 if args.pretty else None)
|
||||
sys.stdout.write("\n")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user