import argparse
import asyncio
from .cve_checker import CVEChecker

def main():
    parser = argparse.ArgumentParser(description="CVE Checker - Check for vulnerabilities in dependencies or specific packages")
    parser.add_argument("--dependencies", help="Path to dependency file (e.g., requirements.txt)")
    parser.add_argument("--package", help="Name of the package to check")
    parser.add_argument("--version", help="Version of the package to check")
    
    args = parser.parse_args()
    
    cve_checker = CVEChecker()
    
    if args.dependencies:
        report = asyncio.run(cve_checker.check_dependencies(args.dependencies))
        print(f"Vulnerability report for dependencies in {args.dependencies}:")
        print(report)
    elif args.package and args.version:
        report = asyncio.run(cve_checker.check_package(args.package, args.version))
        print(f"Vulnerability report for {args.package} version {args.version}:")
        print(report)
    else:
        parser.print_help()

if __name__ == "__main__":
    main()
