Skip to content

A powerful file processing toolkit for batch transformations of HTML, JSON, TOML, XML, and YAML files

Notifications You must be signed in to change notification settings

jet-logic/alterx

Repository files navigation

AlterX - The File Transformation Toolkit

Python Version Tests Status PyPI version fury.io

AlterX is a powerful command-line tool for batch processing and transforming files in various formats. It provides a consistent framework for modifying HTML, JSON, TOML, XML, and YAML files with custom Python logic.

Features

  • Multi-format support: Process HTML, JSON, TOML, XML, and YAML files
  • Extension system: Define transformations in Python scripts
  • Smart modification: Only changes files that need updates
  • Batch processing: Recursively process entire directories
  • Dry run mode: Test changes before applying them
  • Comprehensive logging: Detailed output about modifications

☕ Support

If you find this project helpful, consider supporting me:

ko-fi

Installation

pip install alterx

Quick Start

  1. Create a processing script (e.g., transform.py):
def init(app):
    app.defs['VERSION'] = "2.0.0"

def process(doc, file_info, app):
    if 'version' in doc:
        doc['version'] = app.defs['VERSION']
        return True
  1. Run AlterX:
# Process JSON files
alterx json -x transform.py path/to/files

Example Use Cases

  • JSON Updating API URLs across multiple JSON config files
  • TOML Maintaining consistent Python project TOML files
  • HTML Standardizing HTML documents (adding missing tags, accessibility improvements)
  • XML Processing XML sitemaps (adding/removing URLs, updating dates)
  • YAML Managing Kubernetes YAML manifests (adding labels, updating image tags)

About

A powerful file processing toolkit for batch transformations of HTML, JSON, TOML, XML, and YAML files

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published