From 6b76ed8098ae4090cf2622deb06f1ed9c2edff95 Mon Sep 17 00:00:00 2001 From: Yutaka Matsubara Date: Mon, 10 Mar 2025 08:41:49 +0900 Subject: [PATCH] refactor: enhance --aiderignore argument to resolve absolute and relative paths --- aider/args.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/aider/args.py b/aider/args.py index 846c8ab05..914a477ac 100644 --- a/aider/args.py +++ b/aider/args.py @@ -3,6 +3,7 @@ import argparse import os import sys +from pathlib import Path import configargparse @@ -374,9 +375,19 @@ def get_parser(default_config_files, git_root): default_aiderignore_file = ( os.path.join(git_root, ".aiderignore") if git_root else ".aiderignore" ) + + def resolve_aiderignore_path(path_str): + path = Path(path_str) + if path.is_absolute(): + return str(path) + elif git_root: + return str(Path(git_root) / path) + return str(path) + group.add_argument( "--aiderignore", metavar="AIDERIGNORE", + type=resolve_aiderignore_path, default=default_aiderignore_file, help="Specify the aider ignore file (default: .aiderignore in git root)", )