cli-lite


Namecli-lite JSON
Version 0.9.0 PyPI version JSON
download
home_pageNone
SummaryA simple framework to build a cli tool, base on Alconna
upload_time2024-04-28 14:27:10
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords commandline cli-tool plugin cli litecli
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Cli-Lite

A simple framework to build a cli tool. Base on [`Alconna`](https://github.com/ArcletProject/Alconna)

## install

```powershell
pip install cli-lite
```

## example

write as sample:

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


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}")


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

and execute the line:

```shell
python example.py hello world
```

you will get the result:

```shell
Hello! world
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cli-lite",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "commandline, cli-tool, plugin, cli, litecli",
    "author": null,
    "author_email": "RF-Tar-Railt <rf_tar_railt@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/33/bb/0ae0b6dd9c608c8f88061da853473a2e4c4938df8fcefbfcdac1688fe80f/cli_lite-0.9.0.tar.gz",
    "platform": null,
    "description": "# Cli-Lite\n\nA simple framework to build a cli tool. Base on [`Alconna`](https://github.com/ArcletProject/Alconna)\n\n## install\n\n```powershell\npip install cli-lite\n```\n\n## example\n\nwrite as sample:\n\n```python\n# example.py\nfrom clilte import BasePlugin, CommandLine, PluginMetadata\nfrom arclet.alconna import Alconna, Arparma, Args, CommandMeta\n\n\nclass MyPlugin(BasePlugin):\n\n    def init(self) -> Alconna | str:\n        return Alconna(\"hello\", Args[\"name\", str], meta=CommandMeta(\"test command\"))\n\n    def meta(self) -> PluginMetadata:\n        return PluginMetadata(\"hello\", \"0.0.1\", \"my first plugin\", [\"dev\"], [\"john\"])\n\n    def dispatch(self, result: Arparma) -> bool | None:\n        return print(f\"Hello! {result.name}\")\n\n\nif __name__ == '__main__':\n    cli = CommandLine(title=\"My first CLI\", version=\"example 0.0.1\")\n    cli.add(MyPlugin)\n    cli.load_register('builtin.cache')\n    cli.main()\n```\n\nand execute the line:\n\n```shell\npython example.py hello world\n```\n\nyou will get the result:\n\n```shell\nHello! world\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple framework to build a cli tool, base on Alconna",
    "version": "0.9.0",
    "project_urls": {
        "Bug reports": "https://github.com/RF-Tar-Railt/cli-lite/issues",
        "Homepage": "https://github.com/RF-Tar-Railt/cli-lite",
        "Source": "https://github.com/RF-Tar-Railt/cli-lite"
    },
    "split_keywords": [
        "commandline",
        " cli-tool",
        " plugin",
        " cli",
        " litecli"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4b035b9c2a423de8c8a27eb4dfb4975619aeac37b0579b5c9ae88df9dcca7840",
                "md5": "8212dcf4521602e632c418603508dc61",
                "sha256": "0278cfc02d7cf740089be2db07d1602b947762e3a87a3b01a6e595a313ab69f0"
            },
            "downloads": -1,
            "filename": "cli_lite-0.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8212dcf4521602e632c418603508dc61",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6917,
            "upload_time": "2024-04-28T14:27:08",
            "upload_time_iso_8601": "2024-04-28T14:27:08.973597Z",
            "url": "https://files.pythonhosted.org/packages/4b/03/5b9c2a423de8c8a27eb4dfb4975619aeac37b0579b5c9ae88df9dcca7840/cli_lite-0.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33bb0ae0b6dd9c608c8f88061da853473a2e4c4938df8fcefbfcdac1688fe80f",
                "md5": "c607718b2f0321da45940cbe7a44da1e",
                "sha256": "1cb600dfff9b2affaea545069a79512f6278ddb5ae9da158b8416003f8ba61f0"
            },
            "downloads": -1,
            "filename": "cli_lite-0.9.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c607718b2f0321da45940cbe7a44da1e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6129,
            "upload_time": "2024-04-28T14:27:10",
            "upload_time_iso_8601": "2024-04-28T14:27:10.789191Z",
            "url": "https://files.pythonhosted.org/packages/33/bb/0ae0b6dd9c608c8f88061da853473a2e4c4938df8fcefbfcdac1688fe80f/cli_lite-0.9.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-28 14:27:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RF-Tar-Railt",
    "github_project": "cli-lite",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cli-lite"
}
        
Elapsed time: 0.43255s