-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autodoc params wrap poorly in --help and helptext is duplicated #255
Comments
Wondering if there is any plan to help reduce the repeated help, one in function's docstring (with sphinx autodoc) and the other in --help form? |
This is a me too! Used baker, then mando for my command line helper libraries, both parse the docstring to display help. This is really nice. I was surprised by click having the argument and option help defined twice. I started to dig into the code, and there are several ways to do this and wondered which would be the most likely to be accepted.
Kindest regards, |
Just a tip for those who face duplicated/redundant text showing up in command help: you can override def format_help_text(self, ctx, formatter):
if self.help:
args = 'Args:'
help = self.help
if args in help:
help = help[:help.index(args)] # Remove autodoc stuff
formatter.write_paragraph()
with formatter.indentation():
formatter.write_text(help) |
It looks like we have two outcomes from this issue
|
I think this is more appropriately handled by an extension like sphinx-click. This may become possible as we think about how to rewrite the format system (#561). |
#234 will improve autodocs, but there are more issues.
Right now all of my parameters have their help defined twice. Once in click's decorator for use with
--help
and once in the docstring for use with autodoc.For example:
When you do
--help
with a function like this, the :param: lines get wrapped. I tried just adding a/b
above them which fixes--help
but the generated docs break with that and it seems silly to have to put a new line between every one.Also, without the
/b
in the example, those lines wrap. However, with the/b
there is a blank line at the start of all the autodoc codeblocks.What would be wonderful is if this worked:
The above works great with
--help
right now, but autodoc doesn't have any of the parameter help in it and the example is wrapper.Any ideas how to make
--help
and autodoc play nice?The text was updated successfully, but these errors were encountered: