From 2bb88163f2dfb4b555c343a17514ab2f472cf32f Mon Sep 17 00:00:00 2001 From: Azaucifer <47237500+Azaucifer@users.noreply.github.com> Date: Mon, 7 Sep 2026 13:58:22 +0530 Subject: [PATCH] refactor: extract CLI argument handling --- analyzer.py | 25 +++---------------------- cli/__init__.py | 0 cli/arguments.py | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 cli/__init__.py create mode 100644 cli/arguments.py diff --git a/analyzer.py b/analyzer.py index 9bab0b9..890c32d 100644 --- a/analyzer.py +++ b/analyzer.py @@ -1,5 +1,6 @@ from pathlib import Path -import argparse + +from cli.arguments import create_parser from analysis.file_analysis import analyze_file @@ -12,27 +13,7 @@ def main(): - parser = argparse.ArgumentParser( - description="Analyze a Python codebase and generate a health report." - ) - - parser.add_argument( - "path", - help="Path to the Python codebase", - ) - - parser.add_argument( - "--json", - action="store_true", - help="Generate a JSON report", - ) - - parser.add_argument( - "--output", - default="codebase_report.json", - help="Output file for the JSON report" - ) - + parser = create_parser() args = parser.parse_args() p = Path(args.path) diff --git a/cli/__init__.py b/cli/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cli/arguments.py b/cli/arguments.py new file mode 100644 index 0000000..ddec37b --- /dev/null +++ b/cli/arguments.py @@ -0,0 +1,26 @@ +import argparse + + +def create_parser(): + parser = argparse.ArgumentParser( + description="Analyze a Python codebase and generate a health report." + ) + + parser.add_argument( + "path", + help="Path to the Python codebase", + ) + + parser.add_argument( + "--json", + action="store_true", + help="Generate a JSON report", + ) + + parser.add_argument( + "--output", + default="codebase_report.json", + help="Output file for the JSON report", + ) + + return parser