feat: Allow --install-main-branch to accept a git URL

This commit is contained in:
Trent Robbins (aider) 2025-04-27 12:23:15 -07:00
parent 7d185bb710
commit 38352735c3
2 changed files with 14 additions and 4 deletions

View file

@ -712,8 +712,12 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
analytics.event("exit", reason="Just checking update") analytics.event("exit", reason="Just checking update")
return 0 if not update_available else 1 return 0 if not update_available else 1
# Handle --install-main-branch [url]
if args.install_main_branch: if args.install_main_branch:
success = install_from_main_branch(io) if isinstance(args.install_main_branch, str):
success = install_from_main_branch(io, remote_url=args.install_main_branch)
else: # True, meaning the flag was used without a URL
success = install_from_main_branch(io)
analytics.event("exit", reason="Installed main branch") analytics.event("exit", reason="Installed main branch")
return 0 if success else 1 return 0 if success else 1

View file

@ -12,16 +12,22 @@ from aider.dump import dump # noqa: F401
VERSION_CHECK_FNAME = Path.home() / ".aider" / "caches" / "versioncheck" VERSION_CHECK_FNAME = Path.home() / ".aider" / "caches" / "versioncheck"
def install_from_main_branch(io): def install_from_main_branch(io, remote_url=None):
""" """
Install the latest version of aider from the main branch of the GitHub repository. Install the latest version of aider from the main branch of the GitHub repository.
""" """
if remote_url is None:
remote_url = "git+https://github.com/Aider-AI/aider.git"
source_description = "the main branch"
else:
source_description = remote_url
return utils.check_pip_install_extra( return utils.check_pip_install_extra(
io, io,
None, None,
"Install the development version of aider from the main branch?", f"Install the development version of aider from {source_description}?",
["git+https://github.com/Aider-AI/aider.git"], [remote_url],
self_update=True, self_update=True,
) )