
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
TinyMenu is a simple yet effective utility to simplify and speed up the creation of customizable command-line menus in Python. It is marked by its plain and basic functionality, leaving implementation details up to the developer.
In order to use TinyMenu functionality the following import statement is required:
import tinymenu
The code snippet below will create a basic command-line menu containg one command. An explanation and other available attributes and functions are documented below.
def handle_help_command(cmd, *args):
"""
Function that is called when user enters 'help' command
"""
print('You entered the help command!')
menu = tinymenu.TinyMenu()
menu.prompt = '$> '
command = tinymenu.Command('help', handle_help_command)
command.arg_limit = [0] # Don't allow any command arguments
menu.add_command(command)
menu.run()
Output:
$> help
You entered the help command!
TinyMenu
class:prompt
(expects string) - Stores prompt to be displayed (e.g.: $>
or ~/home>
)interrupt_handler
(expects method/function) - Stores method/function to be called on KeyboardInterrupt
def handle_interrupt()
unknown_command_handler
(expects method/function) - Stores method/function to be called when an unknown command was entered
string
]*string
]def handle_unknown_command(cmd, *cmd_arguments)
invalid_args_handler
(expects method/function) - Stores method/function to be called when a command with invalid command arguments was entered
Command
(see below)]string
]def handle_invalid_args(cmd, *cmd_arguments)
add_command(command)
- Adds a command to the menu
Command
(see below) to be addedremove_command(command)
- Removes a command from the menu
Command
(see below) to be addedrun()
- Starts the menu and listens for inputCommand
class:__init__(command, handler)
- Initialization of Command
instancecommand
(expects string) - Stores name of the command (string to be entered in menu)handler
(expects method/function) - Stores method/function to be called when command entered
Command
]*string
]arg_limit
(expects list of integers) - Stores possible amounts of arguments (None
= no limit)TinyMenu does not have any dependencies and is compatible with Python 2 & Python 3
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.