File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -110,14 +110,12 @@ def _write_opts(opts: ty.List[str]) -> str:
110
110
# documentation thus needs a manually written string.
111
111
extras .append (':default: ``%s``' % show_default )
112
112
elif show_default and opt .default is not None :
113
- extras .append (
114
- ':default: ``%s``'
115
- % (
116
- ', ' .join (str (d ) for d in opt .default )
117
- if isinstance (opt .default , (list , tuple ))
118
- else repr (opt .default ),
119
- )
120
- )
113
+ if isinstance (opt .default , (list , tuple )):
114
+ default = ', ' .join (str (d ) for d in opt .default )
115
+ else :
116
+ default = repr (opt .default )
117
+ if default .strip ():
118
+ extras .append (f":default: ``{ default } ``" )
121
119
122
120
if isinstance (opt .type , click .Choice ):
123
121
extras .append (':options: %s' % ' | ' .join (str (x ) for x in opt .type .choices ))
You can’t perform that action at this time.
0 commit comments