Merger is a tool that scans a directory, filters files using customizable patterns, and merges readable content into a single output file.
Project description
Merger CLI
Merger is a command-line utility for developers that scans a directory, filters files using customizable ignore patterns, and merges all readable content into a single structured output file. It supports custom file readers and validators, making it easily extendable for formats such as .ipynb, .pdf, or any specific format.
Summary
- Core Features
- Dependencies
- Installation with PyPI
- Build and Install Locally
- Usage
- Custom Readers
- CLI Options
- License
Core Features
- Recursive merge of all readable text files under a root directory.
- Glob-based ignore patterns using
.gitignore-style syntax. - Automatic encoding detection.
- Custom file readers and validators for non-text formats.
- CLI support for installation, removal, and listing of custom readers.
- Human-readable merged output, including a directory tree header and file delimiters.
Dependencies
| Component | Version / Type | Notes |
|---|---|---|
| Python | ≥ 3.8 | Required |
All dependencies are listed in requirements.txt.
Install directly from PyPI
pip install merger-cli
Clone and build locally
1. Clone the repository
git clone https://github.com/diogotoporcov/merger-cli.git
cd merger-cli
git clone https://github.com/diogotoporcov/merger-cli.git
cd merger-cli
2. Create and activate a virtual environment
Linux / macOS
python -m venv .venv
source .venv/bin/activate
Windows (PowerShell)
python -m venv .venv
.venv\Scripts\Activate.ps1
3. Install dependencies
pip install -r requirements.txt
4. Install as CLI tool
pip install .
This registers the merger command globally.
Usage
Basic merge
merger ./src ./merged.txt
Custom ignore patterns
merger "C:\Users\USER\Desktop\project" "C:\Users\USER\Desktop\project\output.txt" --ignore "*.log" "__pycache__" "*.tmp"
Custom ignore file
merger . ./output.txt -p ./merger.ignore
Include empty files
merger ./data ./output.txt --empty
Verbose output
merger ./src ./merged.txt --log-level DEBUG
Custom Readers
You can extend Merger to handle new file formats.
Installing a custom reader
merger --install .ipynb path/to/ipynb.py
Where ipynb.py must define:
-
validator: Callable[[Path], bool]
-
reader: Callable[[Path], str]
To uninstall:
merger --uninstall .ipynb
List installed readers:
merger --list-installed
An example .ipynb reader can be found in
examples/custom_readers/ipynb.py.
CLI Options
| Option | Description |
|---|---|
--ignore |
List of glob-style ignore patterns. |
-f, --ignore-file |
Path to file containing ignore patterns (Default: <input_dir>/merger.ignore. |
-i, --install |
Install a custom reader for an extension. |
-u, --uninstall |
Remove a custom reader (* removes all). |
--list-installed |
Show installed readers. |
-l, --log-level |
Set logging verbosity (DEBUG, INFO, etc.). |
--empty |
Include empty files in merged output. |
--prefix / --suffix |
Customize file delimiters in output. |
--overrides |
Load override reader definitions from a Python module. |
--no-tree |
Do not include the generated directory tree in the output file. |
License
This project is licensed under the MIT License — see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file merger_cli-1.0.1.tar.gz.
File metadata
- Download URL: merger_cli-1.0.1.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d25bfdb2eee9dd16af69277dee2f50d187e82d509549775d9f79687d691c3a4
|
|
| MD5 |
be1dc922fc163e7cc33319668fd50dba
|
|
| BLAKE2b-256 |
732a36b1d55f4761b1f34d0e4d1884ffc19888a85f8ac354e13a54c11a54a57a
|
File details
Details for the file merger_cli-1.0.1-py3-none-any.whl.
File metadata
- Download URL: merger_cli-1.0.1-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0d6aaa10de888c850bf028fdf9f48bf0a087d0e9fe9e6f3b9773278f3ff97fe
|
|
| MD5 |
bc309b1c93e931985c26fc3bab2f6037
|
|
| BLAKE2b-256 |
51183ba926fa6c04699768eebe15f3c99f417a0aed38aa7fd1fc865a63a7a82a
|