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.2.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.2-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_prettier_xethhung12-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 3b6e023393fa05a7a9ee26656942c5293837349488dcab068c69fb8dec5c9abe
MD5 8f7813785cda0dd456aa294d71893479
BLAKE2b-256 edbc81f3629802f38f5886a1986f542f581d2880e40f2b7bf1a81e140b96c66e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_prettier_xethhung12-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9bab41a18ac533e0723d97e9c0ecf72c6ac3d198ceb654069a28c17545b5ead9
MD5 255ae66288ab5b92977ceee28fa04b3e
BLAKE2b-256 4b052868ba1333f8185ebd243e908a299db958240646446c3e0bc17dbf793f92

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