A simple framework to build a cli tool, base on Alconna
Project description
A simple framework to build a cli tool. Base on `Alconna <https://github/ArcletProject/Alconna>`__
install
pip install cli-lite
example
write as sample:
from clilte import BasePlugin, CommandLine, PluginMetadata
from arclet.alconna import Alconna, Arpamar, Args
class MyPlugin(BasePlugin):
def _init_command(self) -> Alconna:
return Alconna("hello", Args["name", str])
def dispatch(self, result: Arpamar):
return print(f"Hello! {result.name}")
def meta(self) -> PluginMetadata:
return {"name": "hello", "description": "my first plugin", "author": ["john"], "tags": ["dev"], "version": "0.0.1"}
if __name__ == '__main__':
cli = CommandLine("test", "My first CLI", "0.0.1")
cli.add(MyPlugin)
cli.main(load_preset=True)
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file cli_lite-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: cli_lite-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7ce37416435715ce68bc20a887440db85a884f47358e95c0333830764ee5493 |
|
MD5 | f540b15f2dc833d1b783ce28387fee9c |
|
BLAKE2b-256 | 5516c7fcad94b082451199fb3405ef5284d702cdd3cf71d49358f2e4701e97a2 |