Merge pull request #1056 from aelaguiz/ls_read_only

feat: Add read-only files to the output of the 'ls' command
This commit is contained in:
paul-gauthier 2024-08-10 14:52:03 -07:00 committed by GitHub
commit d5aaa9a2a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -752,6 +752,7 @@ class Commands:
other_files = []
chat_files = []
read_only_files = []
for file in files:
abs_file_path = self.coder.abs_root_path(file)
if abs_file_path in self.coder.abs_fnames:
@ -759,8 +760,13 @@ class Commands:
else:
other_files.append(file)
if not chat_files and not other_files:
self.io.tool_output("\nNo files in chat or git repo.")
# Add read-only files
for abs_file_path in self.coder.abs_read_only_fnames:
rel_file_path = self.coder.get_rel_fname(abs_file_path)
read_only_files.append(rel_file_path)
if not chat_files and not other_files and not read_only_files:
self.io.tool_output("\nNo files in chat, git repo, or read-only list.")
return
if other_files:
@ -768,6 +774,11 @@ class Commands:
for file in other_files:
self.io.tool_output(f" {file}")
if read_only_files:
self.io.tool_output("\nRead-only files:\n")
for file in read_only_files:
self.io.tool_output(f" {file}")
if chat_files:
self.io.tool_output("\nFiles in chat:\n")
for file in chat_files: