mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
refactor: remove ignore_func parameter from FileWatcher.start()
This commit is contained in:
parent
2e63f62215
commit
27540d16ed
1 changed files with 3 additions and 10 deletions
|
@ -120,18 +120,11 @@ class FileWatcher:
|
||||||
|
|
||||||
return filter_func
|
return filter_func
|
||||||
|
|
||||||
# ai remove ignore_func!
|
def start(self):
|
||||||
def start(self, ignore_func=None):
|
|
||||||
"""Start watching for file changes"""
|
"""Start watching for file changes"""
|
||||||
self.stop_event = threading.Event()
|
self.stop_event = threading.Event()
|
||||||
self.changed_files = set()
|
self.changed_files = set()
|
||||||
|
|
||||||
# Update filter_func if ignore_func is provided
|
|
||||||
if ignore_func:
|
|
||||||
gitignore_paths = [Path(g) for g in self.gitignores] if self.gitignores else []
|
|
||||||
gitignore_spec = load_gitignores(gitignore_paths)
|
|
||||||
self.filter_func = self.create_filter_func(gitignore_spec, ignore_func)
|
|
||||||
|
|
||||||
def watch_files():
|
def watch_files():
|
||||||
try:
|
try:
|
||||||
for changes in watch(
|
for changes in watch(
|
||||||
|
@ -240,9 +233,9 @@ def main():
|
||||||
def ignore_test_files(path):
|
def ignore_test_files(path):
|
||||||
return "test" in path.name.lower()
|
return "test" in path.name.lower()
|
||||||
|
|
||||||
watcher = FileWatcher(directory)
|
watcher = FileWatcher(directory, gitignores=args.gitignore)
|
||||||
try:
|
try:
|
||||||
watcher.start(gitignores=args.gitignore, ignore_func=ignore_test_files)
|
watcher.start()
|
||||||
while True:
|
while True:
|
||||||
if changes := watcher.get_changes():
|
if changes := watcher.get_changes():
|
||||||
for file in sorted(changes.keys()):
|
for file in sorted(changes.keys()):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue