mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 06:15:00 +00:00
wip: Added a method to get active files and modified cmd_ls to use it.
This commit is contained in:
parent
e79b33ffc2
commit
aafd524cb2
1 changed files with 23 additions and 8 deletions
|
@ -476,14 +476,29 @@ class Coder:
|
||||||
|
|
||||||
return commit_hash, commit_message
|
return commit_hash, commit_message
|
||||||
|
|
||||||
|
def get_active_files(self):
|
||||||
|
if self.repo:
|
||||||
|
files = sorted(self.repo.git.ls_files().splitlines())
|
||||||
|
else:
|
||||||
|
files = self.fnames
|
||||||
|
|
||||||
|
return files
|
||||||
|
|
||||||
|
def cmd_add(self, args):
|
||||||
|
"Add files to the chat"
|
||||||
|
|
||||||
|
files = self.get_active_files()
|
||||||
|
|
||||||
|
|
||||||
def cmd_ls(self, args):
|
def cmd_ls(self, args):
|
||||||
"List files and show their chat status"
|
"List files and show their chat status"
|
||||||
|
|
||||||
if self.repo:
|
self.console.print(f"* denotes files included in the chat\n")
|
||||||
tracked_files = set(self.repo.git.ls_files().splitlines())
|
files = self.get_active_files()
|
||||||
for file in tracked_files:
|
|
||||||
abs_file_path = os.path.abspath(os.path.join(self.root, file))
|
for file in files:
|
||||||
if abs_file_path in self.fnames:
|
abs_file_path = os.path.abspath(os.path.join(self.root, file))
|
||||||
print(f"{file} (in chat)")
|
if abs_file_path in self.fnames:
|
||||||
else:
|
self.console.print(f"* {file}")
|
||||||
print(file)
|
else:
|
||||||
|
self.console.print(f" {file}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue