From 4ee5c49a0420447060f0b30b14e4c500c9e62da8 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 5 Jul 2023 21:20:22 -0700 Subject: [PATCH] have io.write_text handle dry_run --- aider/io.py | 3 +++ aider/main.py | 1 + 2 files changed, 4 insertions(+) diff --git a/aider/io.py b/aider/io.py index 495f80cca..b5f876188 100644 --- a/aider/io.py +++ b/aider/io.py @@ -101,6 +101,7 @@ class InputOutput: tool_output_color=None, tool_error_color="red", encoding="utf-8", + dry_run=False, ): no_color = os.environ.get("NO_COLOR") if no_color is not None and no_color != "": @@ -144,6 +145,8 @@ class InputOutput: return def write_text(self, filename, content): + if self.dry_run: + return with open(str(filename), "w", encoding=self.encoding) as f: f.write(content) diff --git a/aider/main.py b/aider/main.py index 2028389b6..9e614ecee 100644 --- a/aider/main.py +++ b/aider/main.py @@ -252,6 +252,7 @@ def main(args=None, input=None, output=None): user_input_color=args.user_input_color, tool_output_color=args.tool_output_color, tool_error_color=args.tool_error_color, + dry_run=args.dry_run, ) if args.verbose: