user prompt to del files
This commit is contained in:
@@ -264,6 +264,38 @@ def main():
|
||||
for file, issue in issues_found:
|
||||
print(f"\n{file}:")
|
||||
print(f"{Colors.RED} {issue}{Colors.ENDC}")
|
||||
|
||||
# Prompt to delete problem files
|
||||
print(f"\n{Colors.YELLOW}Files with issues detected.{Colors.ENDC}")
|
||||
response = input("Delete all problematic output files? (yes/no): ").strip().lower()
|
||||
|
||||
if response in ['yes', 'y']:
|
||||
deleted_count = 0
|
||||
failed_count = 0
|
||||
|
||||
for file, issue in issues_found:
|
||||
# Skip "Missing from output" - nothing to delete
|
||||
if issue == "Missing from output":
|
||||
continue
|
||||
|
||||
# Delete output file for all other issues
|
||||
output_path = os.path.join(output_dir, file)
|
||||
if os.path.exists(output_path):
|
||||
try:
|
||||
os.remove(output_path)
|
||||
deleted_count += 1
|
||||
logging.info(f"Deleted problematic output file: {output_path} (Issue: {issue})")
|
||||
print(f"{Colors.GREEN}Deleted: {file}{Colors.ENDC}")
|
||||
except Exception as e:
|
||||
failed_count += 1
|
||||
logging.error(f"Failed to delete {output_path}: {str(e)}")
|
||||
print(f"{Colors.RED}Failed to delete {file}: {str(e)}{Colors.ENDC}")
|
||||
|
||||
print(f"\n{Colors.GREEN}Deleted {deleted_count} file(s){Colors.ENDC}")
|
||||
if failed_count > 0:
|
||||
print(f"{Colors.RED}Failed to delete {failed_count} file(s){Colors.ENDC}")
|
||||
else:
|
||||
print("Deletion cancelled.")
|
||||
else:
|
||||
print(f"{Colors.GREEN}No issues found in any files!{Colors.ENDC}")
|
||||
print("\nIssue counts:")
|
||||
|
||||
Reference in New Issue
Block a user