Jelajahi Sumber

feat: log with() for inputs

Sam Jaffe 1 bulan lalu
induk
melakukan
80b1c4ba22
1 mengubah file dengan 10 tambahan dan 0 penghapusan
  1. 10 0
      src/cipy/runner.py

+ 10 - 0
src/cipy/runner.py

@@ -120,9 +120,19 @@ def preamble(
     if extra is None:
         extra = []
 
+    def log_inputs(self: Action) -> None:
+        inputs = [
+            (k, v) for k, v in vars(self.inputs).items() if v is not None and v != ""
+        ]
+        if inputs:
+            self.logger.info("with:")
+        for key, value in inputs:
+            self.logger.info("  %s: %s", key, value)
+
     @functools.wraps(func)
     def wrapper(self: Action, context: Context) -> Status:
         self.logger.info("##[group] Run %s", self.name)
+        log_inputs(self)
         for color, get_lines in extra:
             fmt = f"{color}%s{Style.reset}"
             for line in get_lines(self):