77 lines
2.2 KiB
Python
77 lines
2.2 KiB
Python
# ucc_py/__main__.py
|
|
|
|
import argparse
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Placeholder for future core logic imports
|
|
# from .core import scanner, counter, metrics, differ, outputs
|
|
|
|
def main():
|
|
"""
|
|
Main entry point for the ucc-py CLI application.
|
|
"""
|
|
parser = argparse.ArgumentParser(
|
|
description="A Python tool to replicate and enhance UCC functionalities."
|
|
)
|
|
|
|
parser.add_argument(
|
|
"baseline_dirs",
|
|
metavar="DIR",
|
|
nargs="*",
|
|
type=Path,
|
|
help="One (for analysis) or two (for diff) directories to process."
|
|
)
|
|
|
|
parser.add_argument(
|
|
"--gui",
|
|
action="store_true",
|
|
help="Launch the graphical user interface (Tkinter)."
|
|
)
|
|
|
|
parser.add_argument(
|
|
"--outdir",
|
|
type=Path,
|
|
default=Path("./ucc_py_output"),
|
|
help="Directory to store output reports."
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
|
|
# If user asked for GUI, or no positional directories were provided, launch GUI and exit
|
|
if args.gui or len(args.baseline_dirs) == 0:
|
|
try:
|
|
from .gui.gui import run_app
|
|
except Exception as e:
|
|
print(f"Errore avviando la GUI: {e}", file=sys.stderr)
|
|
sys.exit(1)
|
|
run_app()
|
|
return
|
|
|
|
# --- Argument Validation for CLI mode ---
|
|
|
|
if len(args.baseline_dirs) > 2:
|
|
print("Error: Maximum of two baseline directories are supported.", file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
for directory in args.baseline_dirs:
|
|
if not directory.is_dir():
|
|
print(f"Error: Path '{directory}' is not a valid directory.", file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
# --- Execution Logic (Placeholder) ---
|
|
print(f"Starting analysis for: {[str(d) for d in args.baseline_dirs]}")
|
|
print(f"Output will be saved to: {args.outdir}")
|
|
|
|
# Ensure output directory exists
|
|
args.outdir.mkdir(parents=True, exist_ok=True)
|
|
|
|
# In the next steps, we will call the core modules from here.
|
|
# For example:
|
|
# file_list_a = scanner.scan_directory(args.baseline_dirs[0])
|
|
# if len(args.baseline_dirs) > 1:
|
|
# file_list_b = scanner.scan_directory(args.baseline_dirs[1])
|
|
# # ... and so on
|
|
|
|
if __name__ == "__main__":
|
|
main() |