def command(pattern):
    """Decorates a function that will be called when a user inputs a
    text command that fits a given pattern.
    """
    def decorator(func):
        func.__ui_command__ = pattern
        return func
    return decorator