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

Uploaded Python 3

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

Hashes for cli_lite-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7ce37416435715ce68bc20a887440db85a884f47358e95c0333830764ee5493
MD5 f540b15f2dc833d1b783ce28387fee9c
BLAKE2b-256 5516c7fcad94b082451199fb3405ef5284d702cdd3cf71d49358f2e4701e97a2

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