cli-formatter
cli-formatter is a python3 utility for formatting console output for cli scripts.
Current Features
- Colored output
- Ability to control the verbosity level
- Two table factories for ASCII tables
Installation
Install the package with pip
pip3 install cli-formatter
Examples
Example 1
from cli_formatter.output_formatting import info, warning, set_verbosity_level
set_verbosity_level(level=3)
info(message='This is a Info message')
info(message='This is a Info message with very low verbosity level', verbosity_level=1)
warning(message='This is a warning')
[+] This is a Info message
[!] This is a warning
Example 2
from cli_formatter.table_builder import TableBuilderClassic, TableBuilderAlternative
header=['Column 1', 'Column 2', 'Column 3']
data=[
['This is a test', '123', 'abc'],
['cli-formatter', 'is', 'awesome']
]
print('classic design:')
classic_builder = TableBuilderClassic()
classic_builder.build_table(header=header, data=data)
print('\nalterative design:')
alternative_builder = TableBuilderAlternative()
alternative_builder.build_table(header=header, data=data)
classic design:
+----------------+----------+----------+
| Column 1 | Column 2 | Column 3 |
+----------------+----------+----------+
| This is a test | 123 | abc |
| cli-formatter | is | awesome |
+----------------+----------+----------+
alterative design:
Column 1 | Column 2 | Column 3
--------------------------------------
This is a test | 123 | abc
cli-formatter | is | awesome
Release files for cli-formatter 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cli-formatter-1.2.0.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cli_formatter-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.1 kB
Release files / cli-formatter-1.2.0.tar.gz
| Download URL | cli-formatter-1.2.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5698b64740c72fda2ec6c12d732271fab78c8c8b65bed8a17db33125b1027da9
|
|
BLAKE2b-256 checksum How to use checksums |
b772112d6e1961d039c15ce2c4cfe56c4f9fcdb2095e7e455094caca7c748d05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|
Release files / cli_formatter-1.2.0-py3-none-any.whl
| Download URL | cli_formatter-1.2.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84c253f7997ec7c4fc4c1de36cc9c7e33e0ea5af342bc824dea2b5edfac60952
|
|
BLAKE2b-256 checksum How to use checksums |
38adf8823398add76eef32fb037ed4185bec3d76a48b2f88927d84083f62ab29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|