71 lines
1.7 KiB
Python
71 lines
1.7 KiB
Python
#!/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()
|