mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
aider: Added --ctags
argument and environment variable to pass to Coder
class.
# Context: USER: add a --ctags arg and env var. pass it to Coder to set self.use_ctags ASSISTANT: To add a `--ctags` argument and environment variable, and pass it to the `Coder` class, follow these steps: 1. Modify `aider/main.py` to add the `--ctags` argument and read the environment variable. 2. Modify the `Coder` class in `aider/coder.py` to accept the `use_ctags` parameter and set it as an instance variable. Here are the necessary code changes: ```python aider/main.py <<<<<<< ORIGINAL parser.add_argument( "--show-diffs", action="store_true", help=f"Show diffs when committing changes (default: False, ${env_prefix}SHOW_DIFFS)", default=bool(int(os.environ.get(f"{env_prefix}SHOW_DIFFS", 0))), ) ======= parser.add_argument( "--show-diffs", action="store_true", help=f"Show diffs when committing changes (default: False, ${env_prefix}SHOW_DIFFS)", default=bool(int(os.environ.get(f"{env_prefix}SHOW_DIFFS", 0))), ) parser.add_argument( "--ctags", action="store_true", help=f"Use ctags for file listing (default: False, ${env_prefix}CTAGS)", default=bool(int(os.environ.get(f"{env_prefix}CTAGS", 0))), ) >>>>>>> UPDATED ``` ```python aider/main.py <<<<<<< ORIGINAL coder = Coder( io, main_model=args.model, fnames=args.files, pretty=args.pretty, show_diffs=args.show_diffs, auto_commits=args.auto_commits, dry_run=args.dry_run, ) ======= coder = Coder( io, main_model=args.model, fnames=args.files, pretty=args.pretty, show_diffs=args.show_diffs, auto_commits=args.auto_commits, dry_run=args.dry_run, use_ctags=args.ctags, ) >>>>>>> UPDATED ``` ```python aider/coder.py <<<<<<< ORIGINAL def __init__( self, io, main_model="gpt-4", fnames=None, pretty=True, show_diffs=False, auto_commits=True, dry_run=False, ): ======= def __init__( self, io, main_model="gpt-4", fnames=None, pretty=True, show_diffs=False, auto_commits=True, dry_run=False, use_ctags=False, ): self.use_ctags = use_ctags >>>>>>> UPDATED ``` These changes add the `--ctags` argument, read the environment variable, and pass the `use_ctags` parameter to the `Coder` class.
This commit is contained in:
parent
8f7d7685d6
commit
68c58ea394
2 changed files with 9 additions and 0 deletions
|
@ -38,7 +38,9 @@ class Coder:
|
|||
show_diffs=False,
|
||||
auto_commits=True,
|
||||
dry_run=False,
|
||||
use_ctags=False,
|
||||
):
|
||||
self.use_ctags = use_ctags
|
||||
self.abs_fnames = set()
|
||||
self.cur_messages = []
|
||||
self.done_messages = []
|
||||
|
|
|
@ -81,6 +81,12 @@ def main(args=None, input=None, output=None):
|
|||
help=f"Show diffs when committing changes (default: False, ${env_prefix}SHOW_DIFFS)",
|
||||
default=bool(int(os.environ.get(f"{env_prefix}SHOW_DIFFS", 0))),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--ctags",
|
||||
action="store_true",
|
||||
help=f"Use ctags for file listing (default: False, ${env_prefix}CTAGS)",
|
||||
default=bool(int(os.environ.get(f"{env_prefix}CTAGS", 0))),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--yes",
|
||||
action="store_true",
|
||||
|
@ -108,6 +114,7 @@ def main(args=None, input=None, output=None):
|
|||
show_diffs=args.show_diffs,
|
||||
auto_commits=args.auto_commits,
|
||||
dry_run=args.dry_run,
|
||||
use_ctags=args.ctags,
|
||||
)
|
||||
if args.auto_commits:
|
||||
coder.commit(ask=True, prefix="wip: ", which="repo_files")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue