dirscribe

Crates.iodirscribe
lib.rsdirscribe
version0.4.0-alpha.1
sourcesrc
created_at2024-12-03 11:17:55.047781
updated_at2024-12-07 13:39:11.520373
descriptionA CLI tool that combines contents of files with specific extensions from a directory
homepagehttps://github.com/0xideas/dirscribe
repositoryhttps://github.com/0xideas/dirscribe
max_upload_size
id1469884
size41,291
leon luithlen (0xideas)

documentation

README

dirscribe

A CLI tool that collects and combines files with specific extensions from a directory into a single output file.

Features

  • Recursive directory traversal
  • Multiple file extensions support
  • Gitignore rules support
  • Path inclusion/exclusion
  • Keyword filtering
  • Clear file separation in output

Installation

cargo install dirscribe

Usage

Basic syntax:

dirscribe <directory_path> <comma_separated_suffixes> [options]

Example:

dirscribe ./src txt,md,rs

Options

  • --use-gitignore: Respect .gitignore rules
  • --exclude-paths: Comma-separated paths to exclude
  • --include-paths: Comma-separated paths to include
  • --or-keywords: Only include files containing at least one of these keywords
  • --and-keywords: Only include files containing all of these keywords
  • --exclude-keywords: Exclude files containing any of these keywords
  • --diff-only: Only process files that have Git changes
  • --start-commit-id: Starting commit ID for Git diff range (optional). If provided alone without end-commit-id, diffs from this commit to the current working directory
  • --end-commit-id: Ending commit ID for Git diff range (optional). Must be used with start-commit-id

Advanced Example

# Example using Git commit range
dirscribe ./src rs,md \
  --diff-only \
  --start-commit-id abc123 \
  --end-commit-id def456

This will only process files that changed between commits abc123 and def456.

Advanced Example with All Options

dirscribe ./src rs,md \
  --use-gitignore \
  --include-paths src \
  --exclude-paths src/core,src/temp \
  --or-keywords "TODO,FIXME" \
  --and-keywords "pub,struct" \
  --exclude-keywords "DEPRECATED,WIP" \
  --diff-only

Output Format

The tool creates dirscribe.txt in the current directory with entries in this format:

File: /path/to/file1.txt
[Contents of file1.txt]

File: /path/to/file2.md
[Contents of file2.md]

License

MIT License

Commit count: 0

cargo fmt