Skip to main content

一个将目录结构和文件内容复制到剪切板的工具

Project description

DirCat

PyPI version License: MIT

一个简单的命令行工具,可以将整个目录的结构和文件内容递归地复制到剪切板或输出到文件,方便与 AI 进行代码分析和调试。

🚀 安装

通过 pip 安装:

pip install dircat

✨ 特性

  • 结构清晰: 开头生成一个完整的目录树,结构一目了然
  • 智能输出: 默认复制到剪切板,但在对于特殊环境,会自动检测并保存到文件
  • 文件输出: 使用 -o 选项可将所有内容直接输出到指定文件
  • 自动忽略: 默认跳过 .git, node_modules, __pycache__ 等常见的元数据和依赖文件夹,无需手动排除
  • 自定义排除: 使用 -n--exclude 选项可以轻松排除您想忽略的任何其他文件或文件夹,支持通配符。

📖 使用方法

基本用法

在您想要复制的项目根目录下,直接运行:

dircat

默认复制到剪切板。在无 GUI 环境下,将自动保存为 dircat_YYYYMMDD_HHMMSS.txt

输出到文件

使用 -o--output 选项指定输出文件:

dircat -o project_snapshot.txt

指定目录

您也可以指定一个特定的目录路径:

dircat /path/to/your/project

排除文件或文件夹

使用 -n--exclude 选项,永久添加忽略规则到 .dircatignore 文件中,支持通配符:

# 排除 build 文件夹和所有 .log 文件
dircat -n "build/" "*.log"

临时忽略文件或文件夹

使用 -i--ignore 选项,可以临时忽略某些文件或文件夹,而不会将其添加到 .dircatignore 文件中。

# 本次运行忽略 build 文件夹和所有 .log 文件
dircat -i "build/" "*.log"

调整项目数量限制

默认情况下,如果一个文件夹下的文件和子文件夹总数超过 20,该文件夹将被跳过。您可以使用 --max-items 选项来修改这个限制:

dircat --max-items 30

📄 许可证

本项目根据 MIT 许可证授权。详情请参阅 LICENSE 文件。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dircat-0.2.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dircat-0.2.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file dircat-0.2.0.tar.gz.

File metadata

  • Download URL: dircat-0.2.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for dircat-0.2.0.tar.gz
Algorithm Hash digest
SHA256 57abc9cf914b83dc3bf7f788dfd125b4103e7f0d9b749e33d873434d4e010049
MD5 f29dd0e9e4cb83e4d3709e667457be08
BLAKE2b-256 8c34d35a7f256039281be1f04e31bc90dab245b3e89af7ccbe2b6abb4a7bcb4d

See more details on using hashes here.

File details

Details for the file dircat-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dircat-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for dircat-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71933e56852e6eed4c9c8719f535224eb5b17bb67a1075736f93f14032826844
MD5 a0f08af7d15e262f43ad6d4d1445db62
BLAKE2b-256 8e5580169766806848471228eb98dde2f15365fda9e8c2bcd8cc8174955550a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page