def cmdmenu_function(param, description=None):
    """Decorator for marking a function to appear in cmdmenu.

    If it is used without a parameter, the function will only be
    marked (necassary for add_build).
    Otherwise it takes two single str, first one is help message,
    second one is description (optional).
    """
    def decorator(func):
        func.cmdmenu_help = param
        if description is not None:
            func.cmdmenu_description = description
        else:
            func.cmdmenu_description = param
        func.cmdmenu_is_marked = True
        return func
    # Decorator used with parameter (return actual decorator)
    if isinstance(param, str):
        return decorator
    # Decorator used without parameter (this is the actual decorator)
    if callable(param):
        param.cmdmenu_is_marked = True
        return param
    raise ValueError("Invalid parameters")