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.4.2.tar.gz
(5.5 kB
view details)
Built Distribution
File details
Details for the file cli-lite-0.4.2.tar.gz
.
File metadata
- Download URL: cli-lite-0.4.2.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 | dc964cd89741f76bb64f76e48e39ea6213081c118577ba513963fbc2f77c0e3f |
|
MD5 | f067d2580bebd20eb885a6a58bf79ac2 |
|
BLAKE2b-256 | 57896a74824b3bcb0d67314b934b2b39289b06813deea845393e504903468c97 |
File details
Details for the file cli_lite-0.4.2-py3-none-any.whl
.
File metadata
- Download URL: cli_lite-0.4.2-py3-none-any.whl
- Upload date:
- Size: 6.2 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 | 686ac64c22b78df0107cf5a2865562df0beaaa4e4bfdb1e248da63f02b73e297 |
|
MD5 | 181a414dc9c1bcf39758551619ff5588 |
|
BLAKE2b-256 | 2779bb8a6a0fee8cd663999560fab5fb02a3c463d961b9df4338cc4e5e924922 |