A CLI tool to format XML, HTML, and JSON with support for stdin, files, and clipboard
Project description
py_prettier_xethhung12
A powerful CLI tool to format XML, HTML, and JSON with support for multiple input and output sources.
Features
- Format Support: XML, HTML, and JSON
- Input Sources:
- stdin (default)
- File (
-f,--file) - Clipboard (
--from-clip)
- Output Destinations:
- stdout (default)
- Clipboard (
--clip) - File (
-o,--output)
- Unicode Support: Proper UTF-8 handling, especially for Windows environments
Installation
pip install py-prettier-xethhung12
Or install from source:
pip install -e .
Usage
Basic Usage
Format JSON from stdin to stdout:
cat input.json | py-prettier-xethhung12 json
Input Options
From stdin (default):
py-prettier-xethhung12 json < input.json
py-prettier-xethhung12 json --stdin < input.json
From file:
py-prettier-xethhung12 xml -f input.xml
py-prettier-xethhung12 html --file messy.html
From clipboard:
py-prettier-xethhung12 json --from-clip
Output Options
To stdout (default):
py-prettier-xethhung12 json < input.json
py-prettier-xethhung12 json --stdout < input.json
To clipboard:
py-prettier-xethhung12 xml -f input.xml --clip
To file:
py-prettier-xethhung12 json -f messy.json -o formatted.json
py-prettier-xethhung12 html --file input.html --output output.html
Combined Examples
Format file and copy to clipboard:
py-prettier-xethhung12 xml -f input.xml --clip
Format clipboard content and save to file:
py-prettier-xethhung12 json --from-clip -o formatted.json
Re-format clipboard content (clipboard to clipboard):
py-prettier-xethhung12 xml --from-clip --clip
Help
py-prettier-xethhung12 -h
py-prettier-xethhung12 json -h
py-prettier-xethhung12 xml -h
py-prettier-xethhung12 html -h
Running the Application
Through Python module:
python -m py_prettier_xethhung12 -h
Through installed script:
py-prettier-xethhung12 -h
Development
The project requires python 3.11+ and pip for dependency management.
Setup
Install development dependencies:
./install-dependencies.sh
This script installs:
- Dependencies from
dev-requirements.txt(build and deployment tools) - Dependencies from
requirements.txt(runtime dependencies)
Build
./build.sh
Build and Deploy
./build-and-deploy.sh
Scripts
| Name | Type | Description |
|---|---|---|
| install-dependencies.sh | Shell script | Install dev and runtime dependencies |
| build.sh | Shell script | Build the package |
| build-and-deploy.sh | Shell script | Build and deploy the package |
Project Versioning
This project uses the xh-py-project-versioning package for version management.
Update Patch Version (dev):
python -m xh_py_project_versioning --patch
Example: 0.0.1 → 0.0.2-dev+000
Promote Dev to Official Release:
python -m xh_py_project_versioning -r
Example: 0.0.2-dev+000 → 0.0.2
Update Patch Version (direct):
python -m xh_py_project_versioning --patch -d
Example: 0.0.1 → 0.0.2
Update Minor Version (direct):
python -m xh_py_project_versioning --minor -d
Example: 0.0.1 → 0.1.0
Update Major Version (direct):
python -m xh_py_project_versioning --major -d
Example: 0.0.1 → 1.0.0
Dependencies
- j-vault-http-client-xethhung12 (>= 0.1.1) - HTTP client library
- beautifulsoup4 (>= 4.12.0) - HTML/XML parsing
- pyperclip (>= 1.8.2) - Clipboard support
License
GPL-3.0-only
Author
Xeth Hung (admin@xethh.me)
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 py_prettier_xethhung12-1.0.0.tar.gz.
File metadata
- Download URL: py_prettier_xethhung12-1.0.0.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d3e98dd77922f554b0920a17d8142aa6cd7ad2777850209a783046c7cd170e4
|
|
| MD5 |
75a124a26f5fddc6b06eadf421567086
|
|
| BLAKE2b-256 |
27b5b91a60daad8a5eadc360ae6e7893f8fa25a5862879c8c9a714acdf903744
|
File details
Details for the file py_prettier_xethhung12-1.0.0-py3-none-any.whl.
File metadata
- Download URL: py_prettier_xethhung12-1.0.0-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7bb0532054af54bb17ff6b5e41400ddeee6eedf070afc2ce792463e38d8bebf
|
|
| MD5 |
2464b144df0361100d150b312a214298
|
|
| BLAKE2b-256 |
dbc4817d0b72ddfa0debc4fdc69a60a1abcfe03f8dd0cd0cae15951a2a42462e
|