Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cli-formatter

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-formatter

An utility for cli script to prettify their output

  • 1.2.0
  • PyPI
  • Socket score

Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc