Skip to main content

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


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

cli_lite-0.2.0-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page