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.3.tar.gz
(5.6 kB
view details)
Built Distribution
File details
Details for the file cli-lite-0.4.3.tar.gz
.
File metadata
- Download URL: cli-lite-0.4.3.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 | 82721adf5ba859f0bc16235dd036d6db8075bd9f888f49e5ea1069ca12ef467f |
|
MD5 | d29aa5ffcd6d1a7f3494c4e762f0d0b9 |
|
BLAKE2b-256 | 22b4ea50c64a644dbb0eed2d4280b0d5e5fcfcf7d2c0390a2676106603f474af |
File details
Details for the file cli_lite-0.4.3-py3-none-any.whl
.
File metadata
- Download URL: cli_lite-0.4.3-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 | 07a76fc7e535deced28a101c4f3faf4005b744573f9fe6321038207ff6fff914 |
|
MD5 | 607abde81ae85ac468e94543043624f2 |
|
BLAKE2b-256 | d4c4b68e43bfbdc6f0ba24e3936b1351bf0849f0d419ff6580c0dda9fb3b9977 |