speed-cli


Namespeed-cli JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/Mnikley/Speed-CLI
SummaryEffortlessly create descriptive, colorized command line interfaces (CLIs) for your script collections!
upload_time2023-05-12 10:36:08
maintainer
docs_urlNone
authorMatthias Ley
requires_python>=3.7,<4.0
licenseMIT
keywords cli command line interface script collection management package management
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Speed-CLI
Effortlessly create descriptive, colorized command line interfaces (CLIs) for your script collections!

Simplify script and package management by quickly creating a CLI that automatically parses arguments and returns of 
your functions. Get an instant understanding of your collection without diving into extensive documentation. 
Customize descriptions and add informative text, making script interaction easy without remembering all the details.

![speed_cli_showcase](https://github.com/Mnikley/Speed-CLI/assets/75040444/53f87e4b-8c88-47cd-81a1-04cbedb41769)

## Basic Usage
```
from speed_cli import CLI
from your_package import test_func, test_func_two, test_func_three

CLI(menu=[
    test_func, 
    test_func_two, 
    test_func_three
])
```
and that's it! With an example `your_package.py` file looking like this:
```
def test_func():
    print("K")

def test_func_two(number):
    print(f"Doing some calculations with: {number}!")

def test_func_three(my_num: int = 5, my_str: str = 'fredl') -> str:
    return f"{my_num**2} {my_str}"
```
this would give you an interactive prompt like this:

![cli_green](https://github.com/Mnikley/Speed-CLI/assets/75040444/0a121305-6f07-447b-89af-b335b4388192)

.. of course, you can always modify your CLI and make it more fancy and descriptive! Lets say i want to give 
the second function some more description, and add custom fields:
```
    from speed_cli import CLI, Color, MenuEntry

    red = Color('red')
    CLI(color="blue",
        menu=[
            test_func,
            MenuEntry(func=test_func_two,
                      title="My second test function",
                      description="This function is used to do this and that!",
                      warning=f"Be aware to pass the argument {red.colorize('number')} !!"
                      ),
            test_func_three
        ])
```
would give you:

![cli_blue](https://github.com/Mnikley/Speed-CLI/assets/75040444/e7443c5e-fbb5-4a1f-917a-c08cd99e8d41)

.. you can also add default arguments for your functions:
```
def test_func(some_str=None, some_int=None):
    print(f"K {some_str} {some_int}")

CLI(menu=[
    MenuEntry(func=test_func, args=["fredi", 10])
])
```

.. the `Color` class also allows you to simply use colored texts in your prints:
```
from speed_cli import Color

c = Color()
print(f"I like {c.colorize('colors')} to {c.colorize('emphasize', color='green', bold=True)} on the "
      f"{c.colorize('important', color='black', background='bg_cyan')} stuff!")
```
gives you:

![color](https://github.com/Mnikley/Speed-CLI/assets/75040444/73853adb-5119-49f7-99b4-f6a7b96495bf)

# TODO:
- currently only accepts strings as arguments, conversions have to be done in underlying function; convert based on types if given

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Mnikley/Speed-CLI",
    "name": "speed-cli",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "CLI,Command Line Interface,Script Collection Management,Package Management",
    "author": "Matthias Ley",
    "author_email": "matthias.ley@pm.me",
    "download_url": "https://files.pythonhosted.org/packages/63/90/7a2bf8dc77eed53fd470ff5f20e643f79e74a766e7360c2152a241c68d6e/speed_cli-0.1.2.tar.gz",
    "platform": null,
    "description": "# Speed-CLI\nEffortlessly create descriptive, colorized command line interfaces (CLIs) for your script collections!\n\nSimplify script and package management by quickly creating a CLI that automatically parses arguments and returns of \nyour functions. Get an instant understanding of your collection without diving into extensive documentation. \nCustomize descriptions and add informative text, making script interaction easy without remembering all the details.\n\n![speed_cli_showcase](https://github.com/Mnikley/Speed-CLI/assets/75040444/53f87e4b-8c88-47cd-81a1-04cbedb41769)\n\n## Basic Usage\n```\nfrom speed_cli import CLI\nfrom your_package import test_func, test_func_two, test_func_three\n\nCLI(menu=[\n    test_func, \n    test_func_two, \n    test_func_three\n])\n```\nand that's it! With an example `your_package.py` file looking like this:\n```\ndef test_func():\n    print(\"K\")\n\ndef test_func_two(number):\n    print(f\"Doing some calculations with: {number}!\")\n\ndef test_func_three(my_num: int = 5, my_str: str = 'fredl') -> str:\n    return f\"{my_num**2} {my_str}\"\n```\nthis would give you an interactive prompt like this:\n\n![cli_green](https://github.com/Mnikley/Speed-CLI/assets/75040444/0a121305-6f07-447b-89af-b335b4388192)\n\n.. of course, you can always modify your CLI and make it more fancy and descriptive! Lets say i want to give \nthe second function some more description, and add custom fields:\n```\n    from speed_cli import CLI, Color, MenuEntry\n\n    red = Color('red')\n    CLI(color=\"blue\",\n        menu=[\n            test_func,\n            MenuEntry(func=test_func_two,\n                      title=\"My second test function\",\n                      description=\"This function is used to do this and that!\",\n                      warning=f\"Be aware to pass the argument {red.colorize('number')} !!\"\n                      ),\n            test_func_three\n        ])\n```\nwould give you:\n\n![cli_blue](https://github.com/Mnikley/Speed-CLI/assets/75040444/e7443c5e-fbb5-4a1f-917a-c08cd99e8d41)\n\n.. you can also add default arguments for your functions:\n```\ndef test_func(some_str=None, some_int=None):\n    print(f\"K {some_str} {some_int}\")\n\nCLI(menu=[\n    MenuEntry(func=test_func, args=[\"fredi\", 10])\n])\n```\n\n.. the `Color` class also allows you to simply use colored texts in your prints:\n```\nfrom speed_cli import Color\n\nc = Color()\nprint(f\"I like {c.colorize('colors')} to {c.colorize('emphasize', color='green', bold=True)} on the \"\n      f\"{c.colorize('important', color='black', background='bg_cyan')} stuff!\")\n```\ngives you:\n\n![color](https://github.com/Mnikley/Speed-CLI/assets/75040444/73853adb-5119-49f7-99b4-f6a7b96495bf)\n\n# TODO:\n- currently only accepts strings as arguments, conversions have to be done in underlying function; convert based on types if given\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Effortlessly create descriptive, colorized command line interfaces (CLIs) for your script collections!",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/Mnikley/Speed-CLI",
        "Repository": "https://github.com/Mnikley/Speed-CLI"
    },
    "split_keywords": [
        "cli",
        "command line interface",
        "script collection management",
        "package management"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4031f6241d89f031d8113c64de453b306f312efb3724187c4f7de48733bd6589",
                "md5": "887004cf62846c0505f2dea85ae2324e",
                "sha256": "3fb375c46b0954b9f6c2f6aa10fb4f0ab5e804bd796e658e39d4f052481f68b6"
            },
            "downloads": -1,
            "filename": "speed_cli-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "887004cf62846c0505f2dea85ae2324e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 6248,
            "upload_time": "2023-05-12T10:36:05",
            "upload_time_iso_8601": "2023-05-12T10:36:05.827372Z",
            "url": "https://files.pythonhosted.org/packages/40/31/f6241d89f031d8113c64de453b306f312efb3724187c4f7de48733bd6589/speed_cli-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "63907a2bf8dc77eed53fd470ff5f20e643f79e74a766e7360c2152a241c68d6e",
                "md5": "7de6ef3be6669cbe826031ed484a04cb",
                "sha256": "04b4c2442926468a986a77e5a6ee37e446c7a940ea46478b4fd5da17f9bcc385"
            },
            "downloads": -1,
            "filename": "speed_cli-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "7de6ef3be6669cbe826031ed484a04cb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 6508,
            "upload_time": "2023-05-12T10:36:08",
            "upload_time_iso_8601": "2023-05-12T10:36:08.288601Z",
            "url": "https://files.pythonhosted.org/packages/63/90/7a2bf8dc77eed53fd470ff5f20e643f79e74a766e7360c2152a241c68d6e/speed_cli-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-12 10:36:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Mnikley",
    "github_project": "Speed-CLI",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "speed-cli"
}
        
Elapsed time: 0.23836s