diff --git a/aider/main.py b/aider/main.py index 61857a772..2371e48c2 100644 --- a/aider/main.py +++ b/aider/main.py @@ -244,12 +244,6 @@ def main(args=None, input=None, output=None): ########## other_group = parser.add_argument_group("Other Settings") - other_group.add_argument( - "--show-map", - action="store_true", - help="Print the repo map and exit", - default=False, - ) other_group.add_argument( "--version", action="version", @@ -274,6 +268,12 @@ def main(args=None, input=None, output=None): help="Enable verbose output", default=False, ) + other_group.add_argument( + "--show-repo-map", + action="store_true", + help="Print the repo map and exit (debug)", + default=False, + ) other_group.add_argument( "--message", "--msg", @@ -369,29 +369,31 @@ def main(args=None, input=None, output=None): setattr(openai, mod_key, val) io.tool_output(f"Setting openai.{mod_key}={val}") - if args.show_map: - repo_map = RepoMap(map_tokens=args.map_tokens, root=git_root, main_model=main_model, io=io, verbose=args.verbose) - print(repo_map) - sys.exit(0) - else: - coder = Coder.create( - main_model, - args.edit_format, - io, - ## - fnames=args.files, - pretty=args.pretty, - show_diffs=args.show_diffs, - auto_commits=args.auto_commits, - dirty_commits=args.dirty_commits, - dry_run=args.dry_run, - map_tokens=args.map_tokens, - verbose=args.verbose, - assistant_output_color=args.assistant_output_color, - code_theme=args.code_theme, - stream=args.stream, - use_git=args.git, - ) + coder = Coder.create( + main_model, + args.edit_format, + io, + ## + fnames=args.files, + pretty=args.pretty, + show_diffs=args.show_diffs, + auto_commits=args.auto_commits, + dirty_commits=args.dirty_commits, + dry_run=args.dry_run, + map_tokens=args.map_tokens, + verbose=args.verbose, + assistant_output_color=args.assistant_output_color, + code_theme=args.code_theme, + stream=args.stream, + use_git=args.git, + ) + + if args.show_repo_map: + other_files = set(coder.get_all_abs_files()) - set(coder.abs_fnames) + if coder.repo_map: + repo_content = coder.repo_map.get_repo_map(coder.abs_fnames, other_files) + print(repo_content) + return if args.dirty_commits: coder.commit(ask=True, which="repo_files")