当我运行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.)
关于python - 如何在 Fabric 中创建自定义帮助菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31724195/