climy
Do CLI applications easily.
Instalation
$ pip install climy
Basic Usage
from climy import Application, Option, Command
def env_handler(comm: Command):
print('do every thing with env')
print(comm)
print(comm.vars)
env_command = Command(
name='env',
description='Create a perfect environ to application',
handler=env_handler
)
app = Application(
name='acme',
title='ACME App',
description='A teste application',
version='0.1.0',
option_default_separator=Option.Separators.EQUAL
)
app.add_command(env_command)
app.add_option('host', 'The server allow host IP number.', short='t', var_type='str')
app.add_option('port', 'Service port.', short='p', var_type='int')
app.add_option('path', 'Execution code path.', var_type='str', var_name='path')
app.run()
$ acmesrv --help
ACME App (version 0.1.0)
Usage:
acme <command> [options] [arguments]
Options:
-h, --help Print this help.
-t, --host=[HOST] The server allow host IP number.
-p, --port=[PORT] Service port.
--path=[PATH] Execution code path.
Commands:
env Create a perfect environ to application
Components
Tables
To print tables quickly, you just need to define a column list with the column title, size and align. Then, preparate a data tuple list with the values in the same columns orders. Below, an example how to print tables.
from climy.console import ctable
columns = ['ID:10>', 'Name:50', 'Birth:15^', 'Weight:10>', 'Hight:10']
data = [
(1, 'Mark White', '26/12/1977', 1.75, 80.0),
(2, 'Eva Wood', '30/11/1983', 1.59, 50.0),
(3, 'John Apple', '26/06/1917', 1.20, 30.0),
(4, 'Linda Jansen', '09/05/1961', 1.63, 61.0)
]
ctable(data, columns=columns)
And the results:
┌──────────┬──────────────────────────────────────────────────┬───────────────┬──────────┬──────────┐
│ ID │ Name │ Birth │ Weight │ Hight │
├──────────┼──────────────────────────────────────────────────┼───────────────┼──────────┼──────────┤
│ 1 │ Mark White │ 26/12/1977 │ 1.75 │ 80.0 │
│ 2 │ Eva Wood │ 30/11/1983 │ 1.59 │ 50.0 │
│ 3 │ John Apple │ 26/06/1917 │ 1.2 │ 30.0 │
│ 4 │ Linda Jansen │ 09/05/1961 │ 1.63 │ 61.0 │
└──────────┴──────────────────────────────────────────────────┴───────────────┴──────────┴──────────┘
Progress Bar
You can print progresses bars by using cprogress function.
from climy.console import cprogress
cprogress(size=50, max=300.0, value=20.0, color='green')
# ━━━───────────────────────────────────────────────
Metadata
Release files for climy 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| climy-0.2.1.tar.gz | 6.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| climy-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / climy-0.2.1.tar.gz
| Download URL | climy-0.2.1.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41fbf9d44e571fb3e2c9a907344a0264d7d290834917254170b91b4f42442543
|
|
BLAKE2b-256 checksum How to use checksums |
5a56a2d1e86a53141c3fdeacafe59df56f497c9ff7d6d49ebfece03c4f53aa0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.6 Linux/5.19.0-45-generic
|
Release files / climy-0.2.1-py3-none-any.whl
| Download URL | climy-0.2.1-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e423ee503edbdc08fe58aec5bb0ce7cd3b0e5ce78f171c11213030583ab4f8c1
|
|
BLAKE2b-256 checksum How to use checksums |
575f50d326077cc31bdeb49cfc3651b2c90ed217cea2fc5d873bdbc09947ccec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.6 Linux/5.19.0-45-generic
|