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.
- 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
If you find this project helpful, consider supporting me:
pip install alterx
- 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
- Run AlterX:
# Process JSON files
alterx json -x transform.py path/to/files
- 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)