From 2681a41abb3d777a32f824a39030233611eee113 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Thu, 14 Nov 2024 15:18:47 -0800 Subject: [PATCH] refactor: Expand read-only file paths to include all files in directories --- aider/main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aider/main.py b/aider/main.py index 0bd3668ad..8a1c7cac1 100644 --- a/aider/main.py +++ b/aider/main.py @@ -540,7 +540,13 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F all_files = args.files + (args.file or []) fnames = [str(Path(fn).resolve()) for fn in all_files] - read_only_fnames = [str(Path(fn).resolve()) for fn in (args.read or [])] + read_only_fnames = [] + for fn in (args.read or []): + path = Path(fn).resolve() + if path.is_dir(): + read_only_fnames.extend(str(f) for f in path.rglob('*') if f.is_file()) + else: + read_only_fnames.append(str(path)) #ai expand any of the read_only_fnames which are dirs to be all the files under them! if len(all_files) > 1: good = True