diff --git a/src/rougail/output_console/__init__.py b/src/rougail/output_console/__init__.py index 810dbe1..235aa04 100644 --- a/src/rougail/output_console/__init__.py +++ b/src/rougail/output_console/__init__.py @@ -119,9 +119,15 @@ class RougailOutputConsole: self.end() return True - def run(self) -> None: + def run(self) -> str: + with self.console.capture() as capture: + self.print() + return capture.get() + + def print(self) -> None: self.exporter() - return self.print() + for out in self.out: + self.console.print(out) def parse_options( self, @@ -216,10 +222,6 @@ class RougailOutputConsole: def end(self): self.out.append(self.output.tree) - def print(self): - for out in self.out: - self.console.print(out) - class OutputFamily: def __init__(