merge-code-0.1.0 is not a library.
me: Merge My Code
Features
- Multi-Directory Support: Merge files from multiple directories simultaneously.
- Smart Filtering: Filter files by extension and size.
- Multiple Output Formats: Supports plain text, Markdown, and JSON formats.
- Preview Mode: List files to be processed without actually merging them.
- Flexible Configuration: Supports strict case-sensitive matching and symbolic link following.
- Detailed Logging: Multi-level log output for easy debugging.
- Optional Features: Supports exclusion patterns, hexadecimal output, and other optional features.
Installation
Install via Cargo (Recommended)
Install from Source
Quick Start
Basic Usage
# Merge all supported files in the current directory into result.txt
# Merge multiple directories
# Specify an output filename
Preview Mode (No Actual Merge)
# List files that would be processed
# Preview multiple directories
Advanced Usage
File Filtering
# Merge only files with specific extensions
# Enable strict case-sensitive matching
# Limit file size (KB)
Output Format
# Markdown format (suitable for documentation)
# JSON format (suitable for programmatic processing)
# Plain text format (default)
Symbolic Link Handling
# Follow symbolic links
Verbose Output
# Different levels of verbosity
Output Examples
Markdown Format Output
```rust
use clap::Parser;
mod cli;
mod merge;
fn main() {
}
JSON Format Output
Plain Text Format Output
FILE: ./src/main.rs
============================================================
use clap::Parser;
mod cli;
mod merge;
fn main() {
// ...
}
Command-Line Options
USAGE:
me [OPTIONS] <DIRECTORIES>...
ARGS:
<DIRECTORIES>...
Directories to process (comma-separated or repeated)
Example: me ./src or me ./src,./tests
OPTIONS:
-e, --extensions <EXTENSIONS>
File extensions to include (comma-separated) [default: rs,toml,html,css,js,json,yaml,yml,xml]
Can be used multiple times: -e rs,toml -e md,json
-f, --format <FORMAT>
Output format [default: plain-text] [possible values: plain-text, markdown, json]
-h, --help
Print help information
-o, --output <OUTPUT>
Output file path [default: result.txt]
-p, --preview
Preview mode: only show the list of files to be processed, do not merge
-v, --verbose...
Increase verbosity (use multiple times for more detail)
-v: warning level -vv: info level -vvv: debug level -vvvv: trace level
-V, --version
Print version information
--strict-case
Perform strict case-sensitive matching on file extensions
--max-file-size <MAX_FILE_SIZE>
Maximum file size limit (KB, 0 means no limit) [default: 0]
--follow-links
Follow symbolic links
--allow-hex <ALLOW_HEX> [Optional feature]
Convert binary files to hexadecimal strings (value indicates max length per line, 0 means no limit)
Troubleshooting
Common Issues
-
File Encoding Issues
Warning: File is not UTF-8 encodedThis warning indicates the file may contain non-text content or use a different encoding. Use the
--allow-hexfeature to handle such files. -
File Size Limits Use the
--max-file-sizeparameter to limit the maximum file size processed, avoiding overly large files. -
Permission Issues Ensure you have appropriate read permissions for the directories and files you want to read.
Debugging Information
Use different levels of the -v flag for more debugging information:
# View detailed processing steps
# View the most detailed trace information (including file names and line numbers)
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Tip: Use me --help to view the complete command-line options and usage instructions.