jjzjj

RawDescriptionHelpFormatter

全部标签

Python 的 argh 库 : preserve docstring formatting in help message

在寻找更快的方法来解析我的脚本中的命令行参数时,我遇到了arghlibrary.我真的很喜欢argh的功能,但我遇到了一个阻止我使用它的缺点,这与我调用--help选项时显示的默认帮助消息有关:默认情况下,函数的文档字符串显示在参数列表的顶部。这很好,但是初始格式丢失了。例如,请参见以下示例脚本importarghdeffunc(foo=1,bar=True):"""Samplefunction.Parameters:foo:floatAnexampleargument.bar:boolAnotherargument."""printfoo,barargh.dispatch_comma