INNER CODE UNIT · Python
__getattr__
Kohei-Wada/taskdog · packages/taskdog-ui/src/taskdog/tui/app.py:381
def __getattr__(self, name: str) -> Any:
"""Dynamically handle action_* methods by delegating to command_factory.
This eliminates the need for 12 nearly-identical action methods.
When Textual calls action_foo(), this method intercepts it and
executes the corresponding "foo" command via command_factory.
Args:
name: Attribute name being accessed
Returns:
Callable that executes the corresponding command
Raises:
AttributeError: If the attribute doesn't match an action pattern
"""
if name in ACTION_TO_COMMAND_MAP:
command_name = ACTION_TO_COMMAND_MAP[name]