#!/usr/bin/env python

import argparse as ap
from spt3g import core

P = ap.ArgumentParser(
    description="Print contents of the given g3 file to standard output"
)
P.add_argument("filename", help=".g3 file to read")
P.add_argument(
    "modules",
    nargs="*",
    help="Python modules(s) to load, e.g. 'spt3g.calibration'. Include the "
    "appropriate spt3g sub-modules(s) to parse objects of 'unknown polymorphic type'."
)
args = P.parse_args()

for lib in args.modules:
    __import__(lib)

for f in core.G3File(args.filename):
    print(f)
