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:

# example.py
from clilte import BasePlugin, CommandLine, PluginMetadata
from arclet.alconna import Alconna, Arparma, Args, CommandMeta, Option


class MyPlugin(BasePlugin):

    def init(self) -> Alconna | str:
        return Alconna("hello", Args["name", str], meta=CommandMeta("test command"))

    def meta(self) -> PluginMetadata:
        return PluginMetadata("hello", "0.0.1", "my first plugin", ["dev"], ["john"])

    def dispatch(self, result: Arparma) -> bool | None:
        return print(f"Hello! {result.name}")

    @classmethod
    def supply_options(cls) -> list[Option] | None:
        return 


if __name__ == '__main__':
    cli = CommandLine(title="My first CLI", version="example 0.0.1")
    cli.add(MyPlugin)
    cli.main()

and execute the line:

python example.py hello world

you will get the result:

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.11.3.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cli_lite-0.11.3-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file cli_lite-0.11.3.tar.gz.

File metadata

  • Download URL: cli_lite-0.11.3.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.6 CPython/3.11.7 Windows/10

File hashes

Hashes for cli_lite-0.11.3.tar.gz
Algorithm Hash digest
SHA256 7911c6a2603b2289e72defbd3185a0deb81f926f909cc8bd15299593166c0e95
MD5 de1d02e4d8e497df36ac11c8243dbc92
BLAKE2b-256 191eff103a40e897e3103151659b53151281ed0d261d4c8b3fbe6a9f6f7a61b9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cli_lite-0.11.3-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.6 CPython/3.11.7 Windows/10

File hashes

Hashes for cli_lite-0.11.3-py3-none-any.whl
Algorithm Hash digest
SHA256 93d3e68bc532a2c39505295b52f3adc8f9bc950f1683256ff3004234d595231d
MD5 06145214f9f8950f810f4c360e73be3d
BLAKE2b-256 4837c9bd8b8fd6d0ad105b0c6060ca4181fda9e9192eaa3fbad421dc73d0b577

See more details on using hashes here.

Supported by

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