cli-formatter


Namecli-formatter JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/wahlflo/cli-formatter
SummaryAn utility for cli script to prettify their output
upload_time2020-05-21 17:01:30
maintainer
docs_urlNone
authorFlorian Wahl
requires_python>=3.6
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```python
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

```python
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
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/wahlflo/cli-formatter",
    "name": "cli-formatter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Florian Wahl",
    "author_email": "florian.wahl.developer@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b7/72/112d6e1961d039c15ce2c4cfe56c4f9fcdb2095e7e455094caca7c748d05/cli-formatter-1.2.0.tar.gz",
    "platform": "",
    "description": "# cli-formatter\n\ncli-formatter is a python3 utility for formatting console output for cli scripts.\n\n## Current Features\n\n* Colored output\n* Ability to control the verbosity level\n* Two table factories for ASCII tables\n\n## Installation\n\nInstall the package with pip\n\n    pip3 install cli-formatter\n\n\n## Examples\n\n### Example 1\n\n```python\nfrom cli_formatter.output_formatting import info, warning, set_verbosity_level\n\nset_verbosity_level(level=3)\n\ninfo(message='This is a Info message')\ninfo(message='This is a Info message with very low verbosity level', verbosity_level=1)\nwarning(message='This is a warning')\n```\n\n```\n[+] This is a Info message\n[!] This is a warning\n```\n\n\n### Example 2\n\n```python\nfrom cli_formatter.table_builder import TableBuilderClassic, TableBuilderAlternative\n\nheader=['Column 1', 'Column 2', 'Column 3']\ndata=[\n    ['This is a test', '123', 'abc'],\n    ['cli-formatter', 'is', 'awesome']\n]\n\nprint('classic design:')\nclassic_builder = TableBuilderClassic()\nclassic_builder.build_table(header=header, data=data)\n\nprint('\\nalterative design:')\nalternative_builder = TableBuilderAlternative()\nalternative_builder.build_table(header=header, data=data)\n```\n\n```\nclassic design:\n+----------------+----------+----------+\n| Column 1       | Column 2 | Column 3 |\n+----------------+----------+----------+\n| This is a test | 123      | abc      |\n| cli-formatter  | is       | awesome  |\n+----------------+----------+----------+\n\nalterative design:\n Column 1       | Column 2 | Column 3\n--------------------------------------\n This is a test | 123      | abc\n cli-formatter  | is       | awesome\n```\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "An utility for cli script to prettify their output",
    "version": "1.2.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "dd96f2ed8bcc8df4041c70c6b6f6750a",
                "sha256": "84c253f7997ec7c4fc4c1de36cc9c7e33e0ea5af342bc824dea2b5edfac60952"
            },
            "downloads": -1,
            "filename": "cli_formatter-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dd96f2ed8bcc8df4041c70c6b6f6750a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6572,
            "upload_time": "2020-05-21T17:01:29",
            "upload_time_iso_8601": "2020-05-21T17:01:29.499851Z",
            "url": "https://files.pythonhosted.org/packages/38/ad/f8823398add76eef32fb037ed4185bec3d76a48b2f88927d84083f62ab29/cli_formatter-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "f4f9a2f4d2f459e7d19f91c8a249f1f3",
                "sha256": "5698b64740c72fda2ec6c12d732271fab78c8c8b65bed8a17db33125b1027da9"
            },
            "downloads": -1,
            "filename": "cli-formatter-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f4f9a2f4d2f459e7d19f91c8a249f1f3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4527,
            "upload_time": "2020-05-21T17:01:30",
            "upload_time_iso_8601": "2020-05-21T17:01:30.637023Z",
            "url": "https://files.pythonhosted.org/packages/b7/72/112d6e1961d039c15ce2c4cfe56c4f9fcdb2095e7e455094caca7c748d05/cli-formatter-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-05-21 17:01:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "wahlflo",
    "github_project": "cli-formatter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cli-formatter"
}
        
Elapsed time: 0.03562s