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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cli_lite-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 718648b32e254be598d9e6f7d952f8ee437d72cf3e814d67673ca7f8fb0f1b8d
MD5 3ea4ee75ffa586daeadb243fe188dfcf
BLAKE2b-256 33880670e85e94a1c03a84c728558df54ab8b77f077a7b594efd39ea43d20402

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