Skip to main content

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


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 hashes)

Uploaded Source

Built Distribution

cli_lite-0.5.1-py3-none-any.whl (6.3 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