Download cli.py from Arvind2006/jenkins-error-explainer: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/spaces/Arvind2006/jenkins-error-explainer/resolve/main/cli.py
- Command line
-
hf download hf://spaces/Arvind2006/jenkins-error-explainer/cli.py
-
curl -L -o cli.py https://huggingface.co/spaces/Arvind2006/jenkins-error-explainer/resolve/main/cli.py
1.14 kB
| # cli.py | |
| import sys | |
| from explain_error import explain_error | |
| def main(): | |
| if len(sys.argv) != 2: | |
| print("Usage: python cli.py <path_to_jenkins_error_log>") | |
| sys.exit(1) | |
| log_path = sys.argv[1] | |
| try: | |
| with open(log_path, "r", encoding="utf-8") as f: | |
| log_text = f.read() | |
| except FileNotFoundError: | |
| print(f"Error: File not found -> {log_path}") | |
| sys.exit(1) | |
| result = explain_error(log_text) | |
| if result["error_category"] == "unknown": | |
| print( | |
| "Warning: This error is not currently supported by the explainer. " | |
| "The explanation may be incomplete.\n" | |
| ) | |
| print("\n=== Jenkins Error Explanation ===\n") | |
| print(f"Error Category:\n{result['error_category']}\n") | |
| print("Error Summary:") | |
| print(result["summary"], "\n") | |
| print("Likely Causes:") | |
| for cause in result["likely_causes"]: | |
| print(f"- {cause}") | |
| print() | |
| print("Relevant Documentation:") | |
| for ref in result["references"]: | |
| print(f"- {ref}") | |
| print("\n================================\n") | |
| if __name__ == "__main__": | |
| main() | |