def main():
  """Command line interface for the converter."""
  parser = argparse.ArgumentParser(
      description=(
          "Convert Google API Discovery documents to OpenAPI v3 specifications"
      )
  )
  parser.add_argument(
      "api_name", help="Name of the Google API (e.g., 'calendar')"
  )
  parser.add_argument("api_version", help="Version of the API (e.g., 'v3')")
  parser.add_argument(
      "--output",
      "-o",
      default="openapi_spec.json",
      help="Output file path for the OpenAPI specification",
  )

  args = parser.parse_args()

  try:
    # Create and run the converter
    converter = GoogleApiToOpenApiConverter(args.api_name, args.api_version)
    converter.convert()
    converter.save_openapi_spec(args.output)
    logger.info(
        "Successfully converted %s %s to OpenAPI v3",
        args.api_name,
        args.api_version,
    )
    logger.info("Output saved to %s", args.output)
  except Exception as e:
    logger.error("Conversion failed: %s", e)
    return 1

  return 0
Command line interface for the converter.
src/google/adk/tools/google_api_tool/googleapi_to_openapi_converter.py