diff --git a/patchwork/common/tools/code_edit_tools.py b/patchwork/common/tools/code_edit_tools.py index 387226c9d..841137c10 100644 --- a/patchwork/common/tools/code_edit_tools.py +++ b/patchwork/common/tools/code_edit_tools.py @@ -133,15 +133,22 @@ def __view(self, abs_path: Path, view_range): content = "\n".join(lines[start - 1 : end]) return content elif abs_path.is_dir(): - result = [] - for root, dirs, files in os.walk(abs_path): - level = root[len(str(abs_path)) :].count(os.sep) - if level <= 2: - for d in dirs: - result.append(d) - for f in files: - result.append(f) - return "\n".join(result) + directories = [] + files = [] + for file in abs_path.iterdir(): + directories.append(file.name) if file.is_dir() else files.append(file.name) + + rv = "" + if len(directories) > 0: + rv += "Directories: \n" + rv += '\n'.join(directories) + rv += "\n" + + if len(files) > 0: + rv += "Files: \n" + rv += '\n'.join(files) + + return rv def __create(self, file_text, abs_path): if abs_path.exists(): diff --git a/pyproject.toml b/pyproject.toml index d72165e45..1d324135d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "patchwork-cli" -version = "0.0.82" +version = "0.0.83" description = "" authors = ["patched.codes"] license = "AGPL"