bash-menu-builder


Namebash-menu-builder JSON
Version 1.1.4 PyPI version JSON
download
home_pagehttps://github.com/OleksiiPopovDev/Bash-Menu-Builder
SummaryBash Menu Builder
upload_time2023-10-30 19:15:20
maintainer
docs_urlNone
authorOleksii.Popov
requires_python>=3.9
license
keywords bash menu vizual python
VCS
bugtrack_url
requirements setuptools twine pynput
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Bash Menu Builder
![PyPI - Version](https://img.shields.io/pypi/v/bash-menu-builder?logo=pypi&logoColor=white)
![Python Version](https://img.shields.io/badge/Python-v3.9-orange?logo=python&logoColor=white)
![PyPI - License](https://img.shields.io/pypi/l/bash-menu-builder)
![PyPI - Downloads](https://img.shields.io/pypi/dm/bash-menu-builder)
![GitHub repo size](https://img.shields.io/github/repo-size/OleksiiPopovDev/Bash-Menu-Builder)

This package help you build menu for yours console scripts

[Installation](#installation) | [Usage](#usage) | [Draw menu](#draw-menu) | [How it works](#how-it-works)

## Installation
For install package to your project use this command:
```shell
pip3 install bash-menu-builder
```

## Usage
Script give opportunity use two type views of menu:
 - [Input Menu](#the-input-type-menu)
 - [Select Menu](#the-select-type-menu)

### The Input type Menu

```python
from bash_menu_builder import InputMenu, MenuItemDto


def banner_text() -> str:
    return 'I\'m Banner Text'

def function_one() -> None:
    print('Script One')

def function_two() -> None:
    print('Script Two')

def function_three() -> None:
    print('Script Three')

    
if __name__ == "__main__":
    InputMenu(
        menu=[
            MenuItemDto(title='Test', option='one', handler=function_one),
            MenuItemDto(title='Test2', option='two', handler=function_two),
            MenuItemDto(title='Test3', option='three', handler=function_three),
        ],
        banner=banner_text()
    )
```
#### View Menu
<img src="https://raw.githubusercontent.com/OleksiiPopovDev/Bash-Menu-Builder/main/doc/example-input.gif" alt="How it works" style="width:100%;" />

### The Select type Menu
```python
from bash_menu_builder import SelectMenu, MenuItemDto


def banner_text() -> str:
    return 'I\'m Banner Text'

def function_one() -> None:
    print('Script One')

def function_two() -> None:
    print('Script Two')

def function_three() -> None:
    print('Script Three')

    
if __name__ == "__main__":
    SelectMenu(
        menu=[
            MenuItemDto(title='Menu Item One', option='one', handler=function_one),
            MenuItemDto(title='Menu Item Two', option='two', handler=function_two),
            MenuItemDto(title='Menu Item Three', option='three', handler=function_three),
        ],
        banner=banner_text()
    )
```
#### View Menu
<img src="https://raw.githubusercontent.com/OleksiiPopovDev/Bash-Menu-Builder/main/doc/example-select.gif" alt="How it works" style="width:100%;" />

## Draw menu
The menu draw via class ``View`` which get params of array with DTOs and text of banner (optional)
The MenuItemDto have 3 params ``def __init__(self, title: str, option_name: str, handler: object):``
 - ``title: str`` - the title of menu item
 - ``option_name: str`` - the option name for call menu via console
 - ``handler: object`` - the handler of menu item. What exactly script do after select this menu item.

## How it works
After select menu number and press Enter will run script in function. When script finish process menu will draw again.

Also you can call script without drawing menu. Just set option when call python script file, ex. ``python3 main.py --three``
In this case will run script for menu **'Menu Item Three'**. When script finish process menu will not draw again and program will close.

<img src="https://github.com/OleksiiPopovDev/Bash-Menu-Builder/blob/main/doc/example-console.png?raw=true" alt="How it works" style="width:100%;" />

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OleksiiPopovDev/Bash-Menu-Builder",
    "name": "bash-menu-builder",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "bash menu vizual python",
    "author": "Oleksii.Popov",
    "author_email": "popovaleksey1991@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/63/c9/a87e754217b8d7beae29e36cac621c30cd480f75de4bc79620b3d981083c/bash_menu_builder-1.1.4.tar.gz",
    "platform": null,
    "description": "# Bash Menu Builder\n![PyPI - Version](https://img.shields.io/pypi/v/bash-menu-builder?logo=pypi&logoColor=white)\n![Python Version](https://img.shields.io/badge/Python-v3.9-orange?logo=python&logoColor=white)\n![PyPI - License](https://img.shields.io/pypi/l/bash-menu-builder)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/bash-menu-builder)\n![GitHub repo size](https://img.shields.io/github/repo-size/OleksiiPopovDev/Bash-Menu-Builder)\n\nThis package help you build menu for yours console scripts\n\n[Installation](#installation) | [Usage](#usage) | [Draw menu](#draw-menu) | [How it works](#how-it-works)\n\n## Installation\nFor install package to your project use this command:\n```shell\npip3 install bash-menu-builder\n```\n\n## Usage\nScript give opportunity use two type views of menu:\n - [Input Menu](#the-input-type-menu)\n - [Select Menu](#the-select-type-menu)\n\n### The Input type Menu\n\n```python\nfrom bash_menu_builder import InputMenu, MenuItemDto\n\n\ndef banner_text() -> str:\n    return 'I\\'m Banner Text'\n\ndef function_one() -> None:\n    print('Script One')\n\ndef function_two() -> None:\n    print('Script Two')\n\ndef function_three() -> None:\n    print('Script Three')\n\n    \nif __name__ == \"__main__\":\n    InputMenu(\n        menu=[\n            MenuItemDto(title='Test', option='one', handler=function_one),\n            MenuItemDto(title='Test2', option='two', handler=function_two),\n            MenuItemDto(title='Test3', option='three', handler=function_three),\n        ],\n        banner=banner_text()\n    )\n```\n#### View Menu\n<img src=\"https://raw.githubusercontent.com/OleksiiPopovDev/Bash-Menu-Builder/main/doc/example-input.gif\" alt=\"How it works\" style=\"width:100%;\" />\n\n### The Select type Menu\n```python\nfrom bash_menu_builder import SelectMenu, MenuItemDto\n\n\ndef banner_text() -> str:\n    return 'I\\'m Banner Text'\n\ndef function_one() -> None:\n    print('Script One')\n\ndef function_two() -> None:\n    print('Script Two')\n\ndef function_three() -> None:\n    print('Script Three')\n\n    \nif __name__ == \"__main__\":\n    SelectMenu(\n        menu=[\n            MenuItemDto(title='Menu Item One', option='one', handler=function_one),\n            MenuItemDto(title='Menu Item Two', option='two', handler=function_two),\n            MenuItemDto(title='Menu Item Three', option='three', handler=function_three),\n        ],\n        banner=banner_text()\n    )\n```\n#### View Menu\n<img src=\"https://raw.githubusercontent.com/OleksiiPopovDev/Bash-Menu-Builder/main/doc/example-select.gif\" alt=\"How it works\" style=\"width:100%;\" />\n\n## Draw menu\nThe menu draw via class ``View`` which get params of array with DTOs and text of banner (optional)\nThe MenuItemDto have 3 params ``def __init__(self, title: str, option_name: str, handler: object):``\n - ``title: str`` - the title of menu item\n - ``option_name: str`` - the option name for call menu via console\n - ``handler: object`` - the handler of menu item. What exactly script do after select this menu item.\n\n## How it works\nAfter select menu number and press Enter will run script in function. When script finish process menu will draw again.\n\nAlso you can call script without drawing menu. Just set option when call python script file, ex. ``python3 main.py --three``\nIn this case will run script for menu **'Menu Item Three'**. When script finish process menu will not draw again and program will close.\n\n<img src=\"https://github.com/OleksiiPopovDev/Bash-Menu-Builder/blob/main/doc/example-console.png?raw=true\" alt=\"How it works\" style=\"width:100%;\" />\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Bash Menu Builder",
    "version": "1.1.4",
    "project_urls": {
        "Documentation": "https://github.com/OleksiiPopovDev/Bash-Menu-Builder",
        "Homepage": "https://github.com/OleksiiPopovDev/Bash-Menu-Builder"
    },
    "split_keywords": [
        "bash",
        "menu",
        "vizual",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bb555da1b172a151194265b9168b895bfb62b91025ed6c2414768dd4582b33ee",
                "md5": "e1aedcc23ee65ed2f97fccd216259838",
                "sha256": "518ec6a619e87ed04ff3d33961f966af2eff1bf016c82e0e0383bc006c5ee17a"
            },
            "downloads": -1,
            "filename": "bash_menu_builder-1.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e1aedcc23ee65ed2f97fccd216259838",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 7220,
            "upload_time": "2023-10-30T19:15:17",
            "upload_time_iso_8601": "2023-10-30T19:15:17.885757Z",
            "url": "https://files.pythonhosted.org/packages/bb/55/5da1b172a151194265b9168b895bfb62b91025ed6c2414768dd4582b33ee/bash_menu_builder-1.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "63c9a87e754217b8d7beae29e36cac621c30cd480f75de4bc79620b3d981083c",
                "md5": "8c4ef7956a75b405817689ac58671a14",
                "sha256": "b306d014e51f7b30d7383f73f999aee381a9aeb5eff84f20e0b21e270fc4ebc6"
            },
            "downloads": -1,
            "filename": "bash_menu_builder-1.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "8c4ef7956a75b405817689ac58671a14",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 5765,
            "upload_time": "2023-10-30T19:15:20",
            "upload_time_iso_8601": "2023-10-30T19:15:20.602902Z",
            "url": "https://files.pythonhosted.org/packages/63/c9/a87e754217b8d7beae29e36cac621c30cd480f75de4bc79620b3d981083c/bash_menu_builder-1.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-30 19:15:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OleksiiPopovDev",
    "github_project": "Bash-Menu-Builder",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "setuptools",
            "specs": []
        },
        {
            "name": "twine",
            "specs": []
        },
        {
            "name": "pynput",
            "specs": [
                [
                    "==",
                    "1.7.6"
                ]
            ]
        }
    ],
    "lcname": "bash-menu-builder"
}
        
Elapsed time: 0.13870s