A powerful command-line tool for gathering context from files, perfect for feeding into Language Models (LLMs).
Features • Installation • Usage • Contributing • License
- 🗂️ Directory Traversal: Recursively walks through directories to gather files.
- 🔍 Extension Filtering: Includes files based on specified extensions.
- ❌ Exclusion Patterns: Excludes files matching specified regex patterns.
- 📋 Clipboard Support: Optionally copies the concatenated content to the clipboard.
- 🔄 Duplicate Detection: Skips duplicate file contents based on content hashes.
- 📑 Consistent Output Order: Ensures the output order of files is consistent.
- Rust and Cargo installed on your system.
- Clone the repository:
git clone https://github.com/hyperb1iss/contexter.git cd contexter
- Build the project:
cargo build --release
- The binary will be located in
target/release/contexter
.
contexter [OPTIONS] <DIRECTORY> [EXTENSIONS]...
-
-c, --clipboard
Copy the concatenated result to the clipboard. -
-e, --exclude <PATTERN>
Exclude filename patterns (supports regex).
To gather all files from a directory and print their contents to stdout:
contexter /path/to/directory
To include only .rs
and .toml
files:
contexter /path/to/directory rs toml
To exclude files matching certain patterns:
contexter /path/to/directory --exclude ".*test.*" --exclude ".*ignore.*"
To copy the concatenated content to the clipboard:
contexter /path/to/directory -c
When running the following command:
contexter /path/to/directory rs -e ".*test.*"
You might get an output like this:
========================================
File: "/path/to/directory/src/main.rs"
========================================
fn main() {
println!("Hello, world!");
}
========================================
File: "/path/to/directory/src/lib.rs"
========================================
pub fn add(a: i32, b: i32) -> i32 {
a + b
}
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. Please see our CONTRIBUTING.md file for details on how to get started.
Distributed under the Apache 2.0 License. See LICENSE
for more information.
🐛 Report Bug • 💡 Request Feature
Created by Stefanie Jane 🌠
If you find this project useful, buy me a Monster Ultra Violet! ⚡️