Skip to main content

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.10.0.2-dev+000

Promote Dev to Official Release:

python -m xh_py_project_versioning -r

Example: 0.0.2-dev+0000.0.2

Update Patch Version (direct):

python -m xh_py_project_versioning --patch -d

Example: 0.0.10.0.2

Update Minor Version (direct):

python -m xh_py_project_versioning --minor -d

Example: 0.0.10.1.0

Update Major Version (direct):

python -m xh_py_project_versioning --major -d

Example: 0.0.11.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


Download files

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

Source Distribution

py_prettier_xethhung12-1.0.1.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

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

py_prettier_xethhung12-1.0.1-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file py_prettier_xethhung12-1.0.1.tar.gz.

File metadata

  • Download URL: py_prettier_xethhung12-1.0.1.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for py_prettier_xethhung12-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5e482abadd57f574a314b75ff6aee693c179c70eb89b356c48f2108752088733
MD5 7e7419e958c6a48406ace25fd4369973
BLAKE2b-256 6b0de87faaa9b2867b9fcccef5c7b8634b824b43abd6ff2c52a6e6108378cb39

See more details on using hashes here.

File details

Details for the file py_prettier_xethhung12-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for py_prettier_xethhung12-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f791998819e42964adfbaaade14a453e3e1a23c6cbf3a4a3cc24d75370328c73
MD5 fb90701e6af42e5c14ddf98bf4dc640c
BLAKE2b-256 3c6b10c72c5bc4c6b62cb3650d72cd7840a216dd005e9bd99929acfdc7bd02bc

See more details on using hashes here.

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