Files
CryoLens/glacierlens_cli.py
2025-12-26 02:49:57 -05:00

71 lines
1.7 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
import argparse
import sys
from pathlib import Path
from glacierlens_master_summary import main as run_master_summary
def cli():
parser = argparse.ArgumentParser(
prog="glacierlens",
description="GlacierLens Semantic insight tools for the GlacierEdge archive.",
)
sub = parser.add_subparsers(dest="command")
# summarize command
summarize = sub.add_parser(
"summarize", help="Generate the full GlacierLens master semantic summary."
)
summarize.add_argument(
"-i",
"--input",
default="glacier_files_inventory.json",
help="Path to the GlacierEdge inventory JSON file.",
)
summarize.add_argument(
"-o",
"--output",
default="glacierlens_master_summary.md",
help="Path to write the Markdown summary.",
)
# stats command (optional future expansion)
stats = sub.add_parser(
"stats", help="Show high-level statistics about the inventory."
)
stats.add_argument(
"-i",
"--input",
default="glacier_files_inventory.json",
help="Path to the GlacierEdge inventory JSON file.",
)
args = parser.parse_args()
if args.command == "summarize":
# Override global variables in the imported script
import glacierlens_master_summary as gl
gl.INPUT_FILE = args.input
gl.OUTPUT_FILE = args.output
run_master_summary()
return
elif args.command == "stats":
# Simple stats mode
import json
with open(args.input, "r") as f:
records = json.load(f)
print(f"Total files: {len(records)}")
return
else:
parser.print_help()
if __name__ == "__main__":
cli()