Skip to content

Commit

Permalink
Handle commands without a docstring
Browse files Browse the repository at this point in the history
'docutils.statemachine.string2lines' doesn't handle 'None', which is
what 'command.help' returns if a command does not have a docstring (from
which the help string is derived).

Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes-Bug: #3
  • Loading branch information
stephenfin committed May 4, 2017
1 parent 9f46dbf commit a7326f6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sphinx_click/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,12 @@ def _generate_nodes(self, name, command, parent=None, show_nested=False):
# We parse this as reStructuredText, allowing users to embed rich
# information in their help messages if they so choose.

for line in statemachine.string2lines(
ctx.command.help, tab_width=4, convert_whitespace=True):
result.append(line, source_name)
if ctx.command.help:
for line in statemachine.string2lines(
ctx.command.help, tab_width=4, convert_whitespace=True):
result.append(line, source_name)

result.append('', source_name)
result.append('', source_name)

# Summary

Expand Down

0 comments on commit a7326f6

Please sign in to comment.