Skip to main content

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

Python License: MIT PyPI

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 .pdf or any specific format.


Summary

  1. Core Features
  2. Dependencies
  3. Installation with PyPI
  4. Build and Install Locally
  5. Usage
  6. Custom Readers
  7. CLI Options
  8. 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 .pdf path/to/pdf.py

Where pdf.py must define:

  • validator: Callable[[Path], bool]
    
  • reader: Callable[[Path], str]
    

To uninstall:

merger --uninstall .pdf

List installed readers:

merger --list-installed

An example .pdf reader can be found in examples/custom_readers/pdf.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.
--version Display current installed version.
-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.
--no-header Do not include the watermark header in the output file.

License

This project is licensed under the MIT License — see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

merger_cli-1.0.10.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

merger_cli-1.0.10-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file merger_cli-1.0.10.tar.gz.

File metadata

  • Download URL: merger_cli-1.0.10.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for merger_cli-1.0.10.tar.gz
Algorithm Hash digest
SHA256 4b8643bf0573ddc1502900d653d2f2d6d769465807c4aa7cbe6681914eb17ef8
MD5 d40416fc1904aa70474a1cfd417848fa
BLAKE2b-256 71f26654d6699e96e2f98fd3a263026e9ded6aa6e78efb515ea8cbc0db57c75c

See more details on using hashes here.

Provenance

The following attestation bundles were made for merger_cli-1.0.10.tar.gz:

Publisher: publish.yml on diogotoporcov/merger-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file merger_cli-1.0.10-py3-none-any.whl.

File metadata

  • Download URL: merger_cli-1.0.10-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for merger_cli-1.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 eb3723c5e5b98fb35b92bb0e4e464fbba9d16b5fbedd90e55bc6cfa01c4dafe8
MD5 ec7842b27be5d179aca9e2a9c4ee1835
BLAKE2b-256 464b59991ac4285c9c7c1104dbb4a642dcc5a57771183e8148d0fd5bd4b9e87a

See more details on using hashes here.

Provenance

The following attestation bundles were made for merger_cli-1.0.10-py3-none-any.whl:

Publisher: publish.yml on diogotoporcov/merger-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page