Simple helper to get pretty printing in the CLI.
Project description
Pretty-CLI: Pretty Printing for the CLI
This package provides PrettyCli
, a class providing utilities for structured printing in the CLI. Simply use its print()
and helper methods instead of the default print()
and you're good to go!
Here is a full example:
from pretty_cli import PrettyCli
cli = PrettyCli()
def main():
cli.main_title("my example file:\nAmazing")
cli.print("Hello, world!")
cli.print("你好!")
cli.big_divisor() # Divisors, titles, etc. add blank space above/under as needed.
cli.print("Let's print a dict:")
cli.blank() # Add a blank if the previous line is not blank already.
cli.blank()
cli.blank()
cli.print({ # Enforces nice alignment of dict contents.
"foo": "bar",
"nested": { "hi": "there" },
"another one": { "how": "are you?", "fine": "thanks" },
})
cli.small_divisor()
cli.print("Some header styles:")
cli.chapter("a chapter")
cli.subchapter("a sub-chapter")
cli.section("a section")
cli.print("That's all, folks!")
if __name__ == "__main__":
main()
And the produced output:
==================================================================
======================== MY EXAMPLE FILE: ========================
============================ AMAZING =============================
==================================================================
Hello, world!
你好!
================================
Let's print a dict:
foo: bar
nested:
hi: there
another one:
how: are you?
fine: thanks
----------------
Some header styles:
================ A Chapter ================
-------- A Sub-Chapter --------
[A Section]
That's all, folks!
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
mff-pretty-cli-0.1.0.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for mff_pretty_cli-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 305c4f680f22cb953429252c7bafca92371a8020b477f99208f79af573bcfbb2 |
|
MD5 | 6b27b173b9481841d98c3c5134c48777 |
|
BLAKE2b-256 | 3d823c353b1f47dbcfe24ba0038df988add155fcfebf47af69df3adf8645fd10 |