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.1.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file cli_lite-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: cli_lite-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.8

File hashes

Hashes for cli_lite-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e7bb90f790ec980098585dfbbc024b9020762e8ca5a16e87b9abbb469a6deea7
MD5 919671dec6d8bb8e79a17455a150eaff
BLAKE2b-256 32524823a3b1f50bcfcf3a4334403e2054a9647ea851491d012942ad9c8857b9

See more details on using hashes here.

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