CLI for prettifying XML
Project description
xml-formatter
Why
Pretty xml output is necessary for debugging xml-based communications and other operations involving XML
What
It is a simple command-line application formatting XML files written in Python
Usage
xml-formatter -i sample.xml -o formatted_test.xml
Installation
Production Build
pip install xml-formatter
Dev Build
Linux
Run with one of the follwing:
bash install.sh
./install.sh
sh install.sh
Windows
Double click on install.bat
or run
install.bat
Usage
python .\xml-format.py -i .\sample.xml -o formatted_test.xml
Register a shell command
The section is about registering shell commands using the Click
library. Maybe you are curious, about crafting your own OS? Go for it! I do it
and it is a lot of fun :)
The best way to have a system wide executable command on both, Windows and Linux systems is to use setuputools.
There is a description in the click package about how to do it
In a nutshell, the setup.py file has to follow a certain pattern, e.g.
from setuptools import setup, find_packages
setup(
name='xml_formatter',
version='0.4.3',
packages=find_packages(),
include_package_data=True,
install_requires=[
'Click',
],
entry_points={
'console_scripts': [
'formatter = xml_formatter.formatter:format',
],
},
)
Then, you can run on Windows:
python -m venv venv
venv/Scripts/activate
pip install --editable .
And on Linux you can run:
python -m venv venv
source venv/bin/activate
pip install --editable .
Then, test the application with:
xml-formatter -i sample.xml -o formatted_test.xml
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
Built Distribution
Hashes for prettify_xml-0.4.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e76f782c6961131218df9cf6e2f64fd122d9d11a2ea54da256b8e28e26273e90 |
|
MD5 | 8ce4d34be4b89e234f63ef2c54c83942 |
|
BLAKE2b-256 | 91b54fe06741e4396c5a422ddd0c7adb3d1a5315ed5e67897a6ebf90bd248a85 |