PrintDirTree
v1.0.1
printdirtree是一个命令行实用程序,可以打印目录树的结构,使您可以轻松地指定文件和目录以排除。
现在,您也可以打印所有文件的内容,这对于提示LLM非常有用。
例子:
$ printdirtree
PrintDirTree
├── MANIFEST.in
├── README.md
├── printdirtree
│ ├── __init__.py
│ └── __main__.py
└── setup.py该工具对于提示Chatgpt非常有用。
使用PIP轻松安装printdirtree :
pip install printdirtree要使用printdirtree ,只需运行命令,然后进行可选参数即可根据您的需求量定制输出。基本用法打印当前目录结构:
printdirtree打印特定目录的结构:
printdirtree --dir /path/to/directory排除特定目录和/或文件模式:
printdirtree --exclude-dir node_modules --exclude-dir .git --exclude-file " *.log "为将来的运行节省您的排除:
printdirtree --exclude-dir temp --exclude-file " *.tmp " --save查看当前保存的排除内容:
printdirtree --view-exclusions要删除排除措施,并将目录或文件包括在打印输出中:
printdirtree --include-dir temp --include-file " *.tmp " --save要显示目录结构和所有文件的内容:
printdirtree --show-contents这将输出目录树,然后将每个文件的内容带有其相对路径作为注释。例如:
temp
├── a.py
└── b.py
# temp/a.py
print("a.py")
# temp/b.py
print("b.py")
与LLMS共享代码时,这特别有用,因为它以清晰,可读的格式提供结构和内容。
安装printdirtree后,您可以运行它以可视化项目目录的结构。这是一个不包括.git文件的示例命令:
printdirtree --exclude-file " .git " PrintDirTree项目的输出可能看起来像这样:
PrintDirTree
├── MANIFEST.in
├── README.md
├── printdirtree
│ ├── __init__.py
│ └── __main__.py
└── setup.py