cli-lite


Namecli-lite JSON
Version 0.10.0 PyPI version JSON
download
home_pageNone
SummaryA simple framework to build a cli tool, base on Alconna
upload_time2024-08-01 02:25:16
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

```shell
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, 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:

```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/d1/cf/7c6d716480c9efd74c04fd676a4e92b007db7c8d9b517e67eba6373e2e86/cli_lite-0.10.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```shell\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, Option\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    @classmethod\n    def supply_options(cls) -> list[Option] | None:\n        return \n\n\nif __name__ == '__main__':\n    cli = CommandLine(title=\"My first CLI\", version=\"example 0.0.1\")\n    cli.add(MyPlugin)\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.10.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": "580570360c50fba5dbb62274a8146f12fda2729cb3b03bee9cc5c879186b19a5",
                "md5": "d546e42bbfb2ccbef9adf147f36bade3",
                "sha256": "9dccca181ec9a72ed8a68f2dd943bbe57c22041bb018badfd4a5952e4eae05ab"
            },
            "downloads": -1,
            "filename": "cli_lite-0.10.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d546e42bbfb2ccbef9adf147f36bade3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7529,
            "upload_time": "2024-08-01T02:25:15",
            "upload_time_iso_8601": "2024-08-01T02:25:15.199563Z",
            "url": "https://files.pythonhosted.org/packages/58/05/70360c50fba5dbb62274a8146f12fda2729cb3b03bee9cc5c879186b19a5/cli_lite-0.10.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d1cf7c6d716480c9efd74c04fd676a4e92b007db7c8d9b517e67eba6373e2e86",
                "md5": "1224a1e4950c5dbe6e4d6280c65d306f",
                "sha256": "85d0d78a60f3f7fb98d29313d44adcbc9136d96ad7479dbbfb626ece3748ba4e"
            },
            "downloads": -1,
            "filename": "cli_lite-0.10.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1224a1e4950c5dbe6e4d6280c65d306f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6512,
            "upload_time": "2024-08-01T02:25:16",
            "upload_time_iso_8601": "2024-08-01T02:25:16.850022Z",
            "url": "https://files.pythonhosted.org/packages/d1/cf/7c6d716480c9efd74c04fd676a4e92b007db7c8d9b517e67eba6373e2e86/cli_lite-0.10.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-01 02:25:16",
    "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: 2.01640s