Skip to main content

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

Project description

DirCat

PyPI version License: MIT

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

🚀 安装

通过 pip 安装:

pip install dircat

✨ 特性

  • 结构清晰: 开头生成一个完整的目录树,结构一目了然
  • 多编码支持: 自动尝试常见编码
  • 智能输出: 默认复制到剪切板,但在无剪切板环境会自动保存到文件
  • 文件输出: 使用 -o 选项可将所有内容直接输出到指定文件
  • 自动忽略: 默认跳过 .git, node_modules, __pycache__ 等常见的元数据和依赖文件夹,无需手动排除
  • 可配置忽略: 使用 -n/--exclude 永久写入 .dircatignore,或 -i/--ignore-temp 临时忽略特定文件/文件夹

📖 使用方法

基本用法

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

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-temp 选项,可以临时忽略某些文件或文件夹,而不会将其添加到 .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.2.tar.gz (10.3 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.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dircat-0.2.2.tar.gz
  • Upload date:
  • Size: 10.3 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.2.tar.gz
Algorithm Hash digest
SHA256 ff96bb804373273d80c158f32460dc160a181c9b93272e09e9c0686cfd6a5c15
MD5 59f92a0f129d164ec76e2bab7c60c0bf
BLAKE2b-256 9874a6e5e2fb515396b5eee2c1b5dbfbe4088d7c4419ab749897725216871045

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dircat-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 8.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cb9ef683974e740db759705594b5a92b24769f58e569f40bcc6271c887bb67c8
MD5 040063e7756074fbc44ca5de6cfc7974
BLAKE2b-256 c4779b91927574a89d336733c4872aa77404ab9d13e61733e16ef08df1348f55

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