Browse Source

Add update summary reporting

nosoop 10 months ago
parent
commit
01e5e32dc4
1 changed files with 12 additions and 0 deletions
  1. 12 0
      src/smgdc/app.py

+ 12 - 0
src/smgdc/app.py

@@ -43,6 +43,7 @@ def main() -> None:
     parser.add_argument("--match", dest="matches", type=str, action="append")
     parser.add_argument("--fail-fast", action="store_true")
     parser.add_argument("--only-failures", action="store_true")
+    parser.add_argument("--show-summary", action="store_true")
 
     args = parser.parse_args()
 
@@ -64,6 +65,7 @@ def main() -> None:
         loaded_bin.path = mount.visible_path
         candidate_targets.append(loaded_bin)
 
+    updated_files = set()
     for validation_file in sorted(validation_files):
         output_partial_path = args.validation_path.relative_to(args.validation_path.parent)
         if args.validation_path.is_dir():
@@ -126,6 +128,7 @@ def main() -> None:
                         continue
 
                 output_file.write_text(output)
+                updated_files.add(output_partial_path)
                 print("- All checks passed; wrote output file")
             except Exception as e:
                 print(f"- Error writing output file; skipped ({type(e).__name__}):", e)
@@ -133,6 +136,15 @@ def main() -> None:
                     traceback.print_exception(e)
                     return
 
+    if args.show_summary:
+        print()
+        if updated_files:
+            print("Updated the following files:")
+            for p in sorted(updated_files):
+                print(f"- {p}")
+        else:
+            print("No files were changed.")
+
 
 if __name__ == "__main__":
     main()