{ "info": { "author": "QiuDev", "author_email": "qiudev@protonmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Terminals" ], "description": "# TinyMenu \n[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![HitCount](http://hits.dwyl.io/QiuDev/TinyMenu.svg)](http://hits.dwyl.io/QiuDev/TinyMenu) [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Naereen/StrapDown.js/graphs/commit-activity) [![Ask Me Anything !](https://img.shields.io/badge/Ask%20me-anything-1abc9c.svg)](https://GitHub.com/Naereen/ama) [![Open Source Love](https://badges.frapsoft.com/os/v3/open-source.svg?v=102)](https://github.com/ellerbrock/open-source-badge/)\n\nTinyMenu is a simple yet effective utility to simplify and speed up the creation of customizable command-line menus in Python.\nIt is marked by its plain and basic functionality, leaving implementation details up to the developer.\n\n## Usage\nIn order to use TinyMenu functionality the following import statement is required:\n```py\nimport tinymenu\n```\n### Creating the menu\nThe code snippet below will create a basic command-line menu containg one command.\nAn explanation and other available attributes and functions are documented below.\n```py\ndef handle_help_command(cmd, *args):\n \"\"\"\n Function that is called when user enters 'help' command\n \"\"\"\n print('You entered the help command!')\n\nmenu = tinymenu.TinyMenu()\nmenu.prompt = '$> '\n\ncommand = tinymenu.Command('help', handle_help_command)\ncommand.arg_limit = [0] # Don't allow any command arguments\n\nmenu.add_command(command)\nmenu.run()\n```\n```\nOutput:\n\n$> help\nYou entered the help command!\n```\n#### ```TinyMenu```class:\n- ```prompt``` (expects string) - Stores prompt to be displayed (e.g.: ```$>``` or ```~/home>```)\n- ```interrupt_handler``` (expects method/function) - Stores method/function to be called on ```KeyboardInterrupt```\n - e.g.: ```def handle_interrupt()```\n- ```unknown_command_handler``` (expects method/function) - Stores method/function to be called when an unknown command was entered\n - **1st** argument: entered command [```string```]\n - **2nd** argument: command arguments [```*string```]\n - **e.g.**: ```def handle_unknown_command(cmd, *cmd_arguments)```\n- ```invalid_args_handler``` (expects method/function) - Stores method/function to be called when a command with invalid command arguments was entered\n - **1st** argument: entered command [```Command``` (see below)]\n - **2nd** argument command arguments [```string```]\n - **e.g.**: ```def handle_invalid_args(cmd, *cmd_arguments)```\n- ```add_command(command)``` - Adds a command to the menu\n - **command** - ```Command``` (see below) to be added\n- ```remove_command(command)``` - Removes a command from the menu\n - **command** - ```Command``` (see below) to be added\n- ```run()``` - Starts the menu and listens for input\n\n#### ```Command```class:\n- ```__init__(command, handler)``` - Initialization of ```Command``` instance\n- ```command``` (expects string) - Stores name of the command (string to be entered in menu)\n- ```handler``` (expects method/function) - Stores method/function to be called when command entered\n - **1st** argument: entered command [```Command```]\n - **2nd** argument: command arguments [```*string```]\n- ```arg_limit``` (expects list of integers) - Stores possible amounts of arguments (```None``` = no limit)\n\n## Dependencies & Compatibility\nTinyMenu does not have any dependencies and is compatible with Python 2 & Python 3\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/QiuDev/tinymenu", "keywords": "menu command commandline cli crossplatform xplatform", "license": "MIT", "maintainer": "QiuDev", "maintainer_email": "", "name": "tinymenu", "package_url": "https://pypi.org/project/tinymenu/", "platform": "", "project_url": "https://pypi.org/project/tinymenu/", "project_urls": { "Homepage": "https://github.com/QiuDev/tinymenu" }, "release_url": "https://pypi.org/project/tinymenu/0.1.0/", "requires_dist": null, "requires_python": ">=2.6", "summary": "Simplifies creation of command-line menus", "version": "0.1.0" }, "last_serial": 3787825, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "959714e7706f7f1921cc096d50c12767", "sha256": "0bdfafa7d3813263b3faa1d19fc0ed18dc999a4fe59666f2bd98c9501a37fe0b" }, "downloads": -1, "filename": "tinymenu-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "959714e7706f7f1921cc096d50c12767", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.6", "size": 5699, "upload_time": "2018-04-21T21:21:13", "url": "https://files.pythonhosted.org/packages/b7/f5/8afd3e3a52089ace052fe8e41a83c1de657e056923be157004b670744e6c/tinymenu-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6fe6d6b34fc4dd8bf15712456fad17e1", "sha256": "7b28bebd89a4df30bd55bb2188b6745230206743faa7996b6eaa5f4cd4026367" }, "downloads": -1, "filename": "tinymenu-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6fe6d6b34fc4dd8bf15712456fad17e1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.6", "size": 4039, "upload_time": "2018-04-21T21:21:15", "url": "https://files.pythonhosted.org/packages/0d/f7/0a1c838b3b6111e5438225d5a4e5eb94626f51a4af01333f316eefc6786f/tinymenu-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "959714e7706f7f1921cc096d50c12767", "sha256": "0bdfafa7d3813263b3faa1d19fc0ed18dc999a4fe59666f2bd98c9501a37fe0b" }, "downloads": -1, "filename": "tinymenu-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "959714e7706f7f1921cc096d50c12767", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.6", "size": 5699, "upload_time": "2018-04-21T21:21:13", "url": "https://files.pythonhosted.org/packages/b7/f5/8afd3e3a52089ace052fe8e41a83c1de657e056923be157004b670744e6c/tinymenu-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6fe6d6b34fc4dd8bf15712456fad17e1", "sha256": "7b28bebd89a4df30bd55bb2188b6745230206743faa7996b6eaa5f4cd4026367" }, "downloads": -1, "filename": "tinymenu-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6fe6d6b34fc4dd8bf15712456fad17e1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.6", "size": 4039, "upload_time": "2018-04-21T21:21:15", "url": "https://files.pythonhosted.org/packages/0d/f7/0a1c838b3b6111e5438225d5a4e5eb94626f51a4af01333f316eefc6786f/tinymenu-0.1.0.tar.gz" } ] }