SaiunCLI


NameSaiunCLI JSON
Version 0.1.9 PyPI version JSON
download
home_pageNone
SummaryA Python framework for making CLI tools prettier and customizable.
upload_time2025-02-21 07:10:16
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT
keywords cli framework rich customizable
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SaiunCLI ✨

[SaiunCLI](https://erickkbentz.github.io/SaiunCLI/) is a Python framework for creating visually appealing, user-friendly, and highly customizable Command-Line Interface (CLI) tools. It leverages the power of [`rich`](https://github.com/Textualize/rich?tab=readme-ov-file) for styling and formatting, making it easy to build modern CLI applications that are both functional and beautiful. 

> Inspired by [rich-cli](https://github.com/Textualize/rich-cli).


![preview image](https://raw.githubusercontent.com/Erickkbentz/SaiunCLI/main/public/saiun_cli_preview.png)

## Project Status: 🚧 Under Construction 🚧
SaiunCLI is actively being developed. Some features may be incomplete or subject to change. Stay tuned for updates and improvements!

## Features

- Customizable Themes: Easily style your CLI with themes and override defaults.
- Command and Subcommand Support: Define commands and nested subcommands with specific options and arguments.
- Inherited Options and Arguments: Configure options to be inherited across subcommands.
- Global Options: Define options that apply globally across all commands and subcommands.
- Modern Styling: Leverage rich to make CLI output visually appealing, including tables, progress bars, and spinners.
- User-Friendly Argument Parsing: Parse both positional arguments and flags in a structured and intuitive manner.
- Dynamic Command Registration: Add commands programmatically during runtime.
- Configurable Help and Usage: Auto-generate help messages for commands with customization options.
- Intuitive Developer Experience: Focus on functionality without worrying about low-level details.

## Comparison with Other Tools
| Feature            | SaiunCLI | Click | Argparse |
|--------------------|---------|-------|----------|
| Custom Styling     | ✅       | ❌     | ❌        |
| Nested Commands    | ✅       | ✅     | ❌        |
| Dynamic Commands   | ✅       | ✅     | ❌        |
| Option Inheritance | ✅       | ❌     | ❌        |
| Global Options     | ✅       | ❌     | ❌        |
| Easy Theming       | ✅       | ❌     | ❌        |


## Installation
You can install `saiuncli` with pip.

```
pip install saiuncli
```

## Usage

```python
from saiuncli.cli import CLI
from saiuncli.command import Command
from saiuncli.option import Option
from saiuncli.theme import Theme

# Custom CLI Theme
theme = Theme()


# Define your command handlers
def hello_handler(name: str, count: int):
    for i in range(count):
        print(f"Hello, {name}!")

def count_handler(a: int, b: int):
    print(f"{a} + {b} = {a + b}")


def base_handler(**args):
    print("Base command executed.")
    print(f"{args}")


if __name__ == "__main__":

    # Create CLI
    mycli = CLI(
        title="My Super Cool CLI Tool",
        description="A simple tool to demonstrate saiuncli.",
        version="1.0.0",
        handler=base_handler, # Command Handler
        help_flags=[],
        version_flags=[],
        options=[
            Option(
                flags=["-v", "--verbose"],
                description="Enable verbose output.",
                action="store_true",
            ),
            Option(
                flags=["-q", "--quiet"],
                description="Enable quiet output.",
                action="store_true",
            ),
            Option(
                flags=["-d", "--debug"],
                description="Enable debug output.",
                action="store_true",
            ),
        ],
    )

    # Define Subcommands
    hello_command = Command(
        name="hello",
        handler=hello_handler,
        description="Prints 'Hello, world!' to the console.",
        options=[
            Option(
                flags=["-n", "--name"],
                description="The name to print.",
                type=str,
                required=True,
            ),
            Option(
                flags=["-c", "--count"],
                description="The number of times to print the name.",
                type=int,
                default=1,
            ),
        ],
    )

    count_command = Command(
        name="count",
        handler=count_handler,
        description="Adds two numbers together.",
        options=[
            Option(
                flags=["-a"],
                description="The first number.",
                type=int,
                required=True,
            ),
            Option(
                flags=["-b"],
                description="The second number.",
                type=int,
                required=True,
            ),
        ],
    )


    # Append Subcommands
    mycli.add_subcommands([hello_command, count_command])

    # Run your CLI Tool!
    mycli.run()

```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "SaiunCLI",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "cli, framework, rich, customizable",
    "author": null,
    "author_email": "Erick Benitez-Ramos <erickbenitez336@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/1c/2f/51cb5b985770ef36745f75fa607ad49c773c8b93b590cd8029be77d43518/saiuncli-0.1.9.tar.gz",
    "platform": null,
    "description": "# SaiunCLI \u2728\n\n[SaiunCLI](https://erickkbentz.github.io/SaiunCLI/) is a Python framework for creating visually appealing, user-friendly, and highly customizable Command-Line Interface (CLI) tools. It leverages the power of [`rich`](https://github.com/Textualize/rich?tab=readme-ov-file) for styling and formatting, making it easy to build modern CLI applications that are both functional and beautiful. \n\n> Inspired by [rich-cli](https://github.com/Textualize/rich-cli).\n\n\n![preview image](https://raw.githubusercontent.com/Erickkbentz/SaiunCLI/main/public/saiun_cli_preview.png)\n\n## Project Status: \ud83d\udea7 Under Construction \ud83d\udea7\nSaiunCLI is actively being developed. Some features may be incomplete or subject to change. Stay tuned for updates and improvements!\n\n## Features\n\n- Customizable Themes: Easily style your CLI with themes and override defaults.\n- Command and Subcommand Support: Define commands and nested subcommands with specific options and arguments.\n- Inherited Options and Arguments: Configure options to be inherited across subcommands.\n- Global Options: Define options that apply globally across all commands and subcommands.\n- Modern Styling: Leverage rich to make CLI output visually appealing, including tables, progress bars, and spinners.\n- User-Friendly Argument Parsing: Parse both positional arguments and flags in a structured and intuitive manner.\n- Dynamic Command Registration: Add commands programmatically during runtime.\n- Configurable Help and Usage: Auto-generate help messages for commands with customization options.\n- Intuitive Developer Experience: Focus on functionality without worrying about low-level details.\n\n## Comparison with Other Tools\n| Feature            | SaiunCLI | Click | Argparse |\n|--------------------|---------|-------|----------|\n| Custom Styling     | \u2705       | \u274c     | \u274c        |\n| Nested Commands    | \u2705       | \u2705     | \u274c        |\n| Dynamic Commands   | \u2705       | \u2705     | \u274c        |\n| Option Inheritance | \u2705       | \u274c     | \u274c        |\n| Global Options     | \u2705       | \u274c     | \u274c        |\n| Easy Theming       | \u2705       | \u274c     | \u274c        |\n\n\n## Installation\nYou can install `saiuncli` with pip.\n\n```\npip install saiuncli\n```\n\n## Usage\n\n```python\nfrom saiuncli.cli import CLI\nfrom saiuncli.command import Command\nfrom saiuncli.option import Option\nfrom saiuncli.theme import Theme\n\n# Custom CLI Theme\ntheme = Theme()\n\n\n# Define your command handlers\ndef hello_handler(name: str, count: int):\n    for i in range(count):\n        print(f\"Hello, {name}!\")\n\ndef count_handler(a: int, b: int):\n    print(f\"{a} + {b} = {a + b}\")\n\n\ndef base_handler(**args):\n    print(\"Base command executed.\")\n    print(f\"{args}\")\n\n\nif __name__ == \"__main__\":\n\n    # Create CLI\n    mycli = CLI(\n        title=\"My Super Cool CLI Tool\",\n        description=\"A simple tool to demonstrate saiuncli.\",\n        version=\"1.0.0\",\n        handler=base_handler, # Command Handler\n        help_flags=[],\n        version_flags=[],\n        options=[\n            Option(\n                flags=[\"-v\", \"--verbose\"],\n                description=\"Enable verbose output.\",\n                action=\"store_true\",\n            ),\n            Option(\n                flags=[\"-q\", \"--quiet\"],\n                description=\"Enable quiet output.\",\n                action=\"store_true\",\n            ),\n            Option(\n                flags=[\"-d\", \"--debug\"],\n                description=\"Enable debug output.\",\n                action=\"store_true\",\n            ),\n        ],\n    )\n\n    # Define Subcommands\n    hello_command = Command(\n        name=\"hello\",\n        handler=hello_handler,\n        description=\"Prints 'Hello, world!' to the console.\",\n        options=[\n            Option(\n                flags=[\"-n\", \"--name\"],\n                description=\"The name to print.\",\n                type=str,\n                required=True,\n            ),\n            Option(\n                flags=[\"-c\", \"--count\"],\n                description=\"The number of times to print the name.\",\n                type=int,\n                default=1,\n            ),\n        ],\n    )\n\n    count_command = Command(\n        name=\"count\",\n        handler=count_handler,\n        description=\"Adds two numbers together.\",\n        options=[\n            Option(\n                flags=[\"-a\"],\n                description=\"The first number.\",\n                type=int,\n                required=True,\n            ),\n            Option(\n                flags=[\"-b\"],\n                description=\"The second number.\",\n                type=int,\n                required=True,\n            ),\n        ],\n    )\n\n\n    # Append Subcommands\n    mycli.add_subcommands([hello_command, count_command])\n\n    # Run your CLI Tool!\n    mycli.run()\n\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python framework for making CLI tools prettier and customizable.",
    "version": "0.1.9",
    "project_urls": {
        "homepage": "https://github.com/Erickkbentz/SaiunCLI",
        "repository": "https://github.com/Erickkbentz/SaiunCLI"
    },
    "split_keywords": [
        "cli",
        " framework",
        " rich",
        " customizable"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4ad0d8ec3db6385749b6664a2a488d3bdd4735d7ccf53aaba39c813fe1d0890c",
                "md5": "2389441500edd7ba0955cb35a0d98bed",
                "sha256": "804c144618513ff885949a01ee3fad17db83b97e4f6527595953e7584c68c5c2"
            },
            "downloads": -1,
            "filename": "SaiunCLI-0.1.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2389441500edd7ba0955cb35a0d98bed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 14356,
            "upload_time": "2025-02-21T07:10:14",
            "upload_time_iso_8601": "2025-02-21T07:10:14.927205Z",
            "url": "https://files.pythonhosted.org/packages/4a/d0/d8ec3db6385749b6664a2a488d3bdd4735d7ccf53aaba39c813fe1d0890c/SaiunCLI-0.1.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1c2f51cb5b985770ef36745f75fa607ad49c773c8b93b590cd8029be77d43518",
                "md5": "9816a802680b540e41fed344b95acd5f",
                "sha256": "25699bf4640570913f890419b5d2d7a9a2a398203b3d7d9c62ae2f05f20f35db"
            },
            "downloads": -1,
            "filename": "saiuncli-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "9816a802680b540e41fed344b95acd5f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 12611,
            "upload_time": "2025-02-21T07:10:16",
            "upload_time_iso_8601": "2025-02-21T07:10:16.230067Z",
            "url": "https://files.pythonhosted.org/packages/1c/2f/51cb5b985770ef36745f75fa607ad49c773c8b93b590cd8029be77d43518/saiuncli-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-21 07:10:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Erickkbentz",
    "github_project": "SaiunCLI",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "saiuncli"
}
        
Elapsed time: 1.63420s