如何在 Fabric 中创建自定义帮助菜单?

How can I create a custom help menu in Fabric?

当我 运行 fab --list 我得到输出

error                        Call ``func`` with given error ``message``.
get_all_tags
get_head_position
get_latest_patch
get_latest_tag
get_pending_patches
glob                         Return a list of paths matching a pathname pattern.
handle_prompt_abort
help
indent                       Return ``text`` indented by the given number of spaces.

这包含几个用户定义的函数,如 get_all_tags get_head_position 等,但没有任何描述。
我希望也包括这些函数的描述,以便我的列表看起来像像这样

error                        Call ``func`` with given error ``message``.
get_all_tags                 Returns a list of all available tags
get_head_position            Returns the current Head position
get_latest_patch             Returns most recently created patch file name
get_latest_tag               Returns the most recent tags among all the tags
get_pending_patches          Returns list of all patches which are yet to be applied
glob                         Return a list of paths matching a pathname pattern.
handle_prompt_abort
help
indent                       Return ``text`` indented by the given number of spaces.

我该怎么做?

向函数添加文档字符串。

@task
def get_all_tags():
    "This is a docstring ..."

文档字符串用于显示帮助信息。

根据fab -l option documentation

Imports a fabfile as normal, but then prints a list of all discovered tasks and exits. Will also print the first line of each task’s docstring, if it has one, next to it (truncating if necessary.)