A simple framework to build a cli tool, base on Alconna
Project description
Cli-Lite
A simple framework to build a cli tool. Base on Alconna
install
pip install cli-lite
example
write as sample:
from clilte import BaseCommand, CommandLine, CommandMetadata
from arclet.alconna import Alconna, Arparma, Args
class MyCommand(BaseCommand):
def init_plugin(self) -> Alconna:
return Alconna("hello", Args["name", str])
def dispatch(self, result: Arparma):
return print(f"Hello! {result.name}")
def meta(self) -> CommandMetadata:
return CommandMetadata("hello", "0.0.1", "my first plugin", ["dev"], ["john"])
if __name__ == '__main__':
cli = CommandLine(
"test",
"My first CLI",
"0.0.1"
)
cli.add(MyCommand)
cli.main()
and execute the line:
python test.py hello world
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
cli-lite-0.5.0.tar.gz
(5.5 kB
view details)
Built Distribution
File details
Details for the file cli-lite-0.5.0.tar.gz
.
File metadata
- Download URL: cli-lite-0.5.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.1.3 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a62015a1ccbc546e2dcc5957e2da13db766c59d2996c4059769b40993bb5f9dc |
|
MD5 | f6c90c71cfde6b3fb44e7433923d3e4b |
|
BLAKE2b-256 | 853770270d844f851c9a1609e900a67aabbe3fe8ba8082b5d19617cee5684568 |
File details
Details for the file cli_lite-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: cli_lite-0.5.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.1.3 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66b3fac30a43efec21d6487cfec76489fb20eb0703bb339902793bcc8f837168 |
|
MD5 | 86d8be17899f5dbea8d1060818c4c625 |
|
BLAKE2b-256 | 5830915c46dc8ca9b18304f2eeba6e48ed6fb05ffe48a2020076a814515edd28 |