Skip to content

Latest commit

 

History

History
145 lines (95 loc) · 3.37 KB

README.md

File metadata and controls

145 lines (95 loc) · 3.37 KB

🚀 Contexter

License

A powerful command-line tool for gathering context from files, perfect for feeding into Language Models (LLMs).

FeaturesInstallationUsageContributingLicense

✨ Features

  • 🗂️ 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.

🛠️ Installation

Prerequisites

  • Rust and Cargo installed on your system.

Building from Source

  1. Clone the repository:
    git clone https://github.com/hyperb1iss/contexter.git
    cd contexter
  2. Build the project:
    cargo build --release
  3. The binary will be located in target/release/contexter.

🚀 Usage

contexter [OPTIONS] <DIRECTORY> [EXTENSIONS]...

Options

  • -c, --clipboard
    Copy the concatenated result to the clipboard.

  • -e, --exclude <PATTERN>
    Exclude filename patterns (supports regex).

Examples

Basic Usage

To gather all files from a directory and print their contents to stdout:

contexter /path/to/directory

Filtering by Extensions

To include only .rs and .toml files:

contexter /path/to/directory rs toml

Excluding Patterns

To exclude files matching certain patterns:

contexter /path/to/directory --exclude ".*test.*" --exclude ".*ignore.*"

Copy to Clipboard

To copy the concatenated content to the clipboard:

contexter /path/to/directory -c

Example Output

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
}

🤝 Contributing

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.

📄 License

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! ⚡️