Provice a list of files to prompt and explain the content of the files.
Directory File Processor is a Rust-based command-line tool that recursively traverses directories, filters files based on specified extensions and criteria, processes their content, and renders the result using customizable templates.
- Recursive directory traversal
- File filtering based on extensions
- Configurable file and folder exclusion
- Content processing with regular expressions
- Output rendering using customizable templates
- Multi-threaded processing for improved performance
- Support for file-based and standard output
To install the Directory File Processor, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/directory-file-processor.git cd directory-file-processor
-
Build the project using Cargo:
cargo build --release
-
The executable will be located in the
target/release
directory.
To perform a traversal of the current directory and process all .rs
files:
./target/release/directory-file-processor
To specify a different starting directory and file extensions:
./target/release/directory-file-processor --dir_path /path/to/dir --file_patterns "rs,txt"
To save the output to a specific file:
./target/release/directory-file-processor --output_file output.txt
To limit the number of lines processed from each file:
./target/release/directory-file-processor --lines 50
To clean the input using regular expressions before processing:
./target/release/directory-file-processor --clean_input_enabled true
To ignore specific files and folders:
./target/release/directory-file-processor --ignore_files "file1.rs,file2.txt" --ignore_folders "folder1,folder2"
To use a custom template for rendering the output:
./target/release/directory-file-processor --template custom_template
To list all available templates:
./target/release/directory-file-processor --list_templates
You can configure Directory File Processor using the following command-line arguments:
--dir_path
: Starting directory for the traversal (default:.
).--file_patterns
: Comma-separated list of file extensions to process (default:txt,py,c,go,rs,java,js,html,ts
).--output_file
: Path to the output file (default: empty, meaning standard output).--lines
: Limit the number of lines to process from each file (default:-1
, meaning no limit).--clean_input_enabled
: Enable cleaning of input using regular expressions (default:true
).--files
: Optional list of specific files to process.--ignore_files
: Comma-separated list of file names to ignore.--ignore_folders
: Comma-separated list of folder names to ignore.--template
: The template file to render the output (default:default
).--list_templates
: List all available templates.
We welcome contributions to improve Directory File Processor! To contribute:
- Fork the repository.
- Create a new branch with a descriptive name.
- Make your changes and test them thoroughly.
- Commit your changes with a clear commit message.
- Push your changes to your forked repository.
- Submit a pull request to the main repository.
Please ensure your code adheres to the existing coding standards and passes all tests.
You can test Directory File Processor by running:
cargo test
This command will execute all unit tests and integration tests defined in the codebase.
./target/release/files_to_prompt -d $(pwd) -e "rs,json" -l 50
./target/release/files_to_prompt -d $(pwd) -e "rs,json" -l 50 | llm -s "Explain this sources code and show results in the table" -m gemini-1.5-pro-latest
./target/release/files-to-prompt -d mistral.rs/ -e "rs,json" -l 50
./target/release/files-to-prompt -f Cargo.toml -f README.md
cargo build --release
This project is licensed under the MIT License. See the LICENSE file for details.
This project uses the following libraries and tools:
- Clap for command-line argument parsing
- Rayon for data parallelism
- Regex for regular expression support
- Tera for template rendering
- Rust-embed for embedding assets
Special thanks to all the open-source contributors and the Rust community for their valuable work.