from __future__ import annotations

import argparse
from pathlib import Path

from capture_format_v2 import file_summary, read_capture
from pipeline_common import write_json


def main() -> None:
    parser = argparse.ArgumentParser()
    parser.add_argument("captures", nargs="+", type=Path)
    parser.add_argument("--out", type=Path, required=True)
    args = parser.parse_args()
    summaries = [file_summary(read_capture(path)) for path in args.captures]
    write_json(args.out, {"captures": summaries})
    for summary in summaries:
        print(summary)


if __name__ == "__main__":
    main()
