mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
refactor: Move find_common_root
into aider/utils.py
and update Coder
class to use it
This commit is contained in:
parent
8c886d7dd3
commit
221cde0fed
2 changed files with 11 additions and 7 deletions
|
@ -434,13 +434,7 @@ class Coder:
|
|||
bold = False
|
||||
|
||||
def find_common_root(self):
|
||||
if len(self.abs_fnames) == 1:
|
||||
self.root = os.path.dirname(list(self.abs_fnames)[0])
|
||||
elif self.abs_fnames:
|
||||
self.root = os.path.commonpath(list(self.abs_fnames))
|
||||
else:
|
||||
self.root = os.getcwd()
|
||||
|
||||
self.root = utils.find_common_root(self.abs_fnames)
|
||||
self.root = utils.safe_abs_path(self.root)
|
||||
|
||||
def add_rel_fname(self, rel_fname):
|
||||
|
|
|
@ -272,6 +272,16 @@ class Spinner:
|
|||
print("\r" + " " * (len(self.text) + 3))
|
||||
|
||||
|
||||
import os
|
||||
|
||||
def find_common_root(abs_fnames):
|
||||
if len(abs_fnames) == 1:
|
||||
return os.path.dirname(list(abs_fnames)[0])
|
||||
elif abs_fnames:
|
||||
return os.path.commonpath(list(abs_fnames))
|
||||
else:
|
||||
return os.getcwd()
|
||||
|
||||
def check_pip_install_extra(io, module, prompt, pip_install_cmd):
|
||||
try:
|
||||
__import__(module)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue