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(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.1.tar.gz
(5.6 kB
view details)
Built Distribution
File details
Details for the file cli-lite-0.5.1.tar.gz
.
File metadata
- Download URL: cli-lite-0.5.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.1.3 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b24f733b39a23741f54cadaeb238aee95627341b94f20ee74f8102ae507cea32 |
|
MD5 | f4008275bc5e455e01e6fd7090386d45 |
|
BLAKE2b-256 | cd8c6758a19efb2a8a5304c44d9f440feda09ac21ba7d173523b706ea11b9e13 |
File details
Details for the file cli_lite-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: cli_lite-0.5.1-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 | 885384d0f89013b5fe3b9e0b9d3b838dbc41680148a82fe2398c841393ad9e7a |
|
MD5 | c8e974a560b26aa6346cabf28a27afad |
|
BLAKE2b-256 | b9840d95fb4ec83cb36f48ee9f212ac8d1902d982400b5282687f81dc2684a7f |