Pythonic task execution library for managing shell-oriented subprocesses and organizing executable Python code into CLI-invokable tasks
Overall
score
96%
Build a Python utility that handles raw character input from the terminal and adapts output based on terminal dimensions.
Your implementation should provide two main capabilities:
Create a function that reads individual characters from the terminal in real-time without waiting for Enter to be pressed. The function should:
Create a function that detects and reports the current terminal size. The function should:
@generates
def read_character():
"""
Read a single character from terminal input without waiting for Enter.
Returns:
str: A single character that was pressed
"""
pass
def get_terminal_size():
"""
Get the current terminal dimensions.
Returns:
dict: Dictionary with 'width' and 'height' keys representing columns and rows
"""
passread_character() is called and the user presses 'a', it returns 'a' immediately without requiring Enter @testget_terminal_size() is called in a terminal with 80 columns and 24 rows, it returns a dictionary with width=80 and height=24 @testget_terminal_size() is called in an environment without a terminal, it handles the situation gracefully without crashing @testProvides terminal control and PTY utilities for low-level terminal operations.
Install with Tessl CLI
npx tessl i tessl/pypi-invokedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10