Skip to content

Commit 0efd1a0

Browse files
committed
DEV: Fix duplication of docs in extend_command
Signed-off-by: Gagandeep Singh <[email protected]>
1 parent fee6abe commit 0efd1a0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

spin/cmds/util.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,15 @@ def parent_cmd(*user_args, **user_kwargs):
170170
my_cmd.callback = click.pass_context(callback_with_parent_callback)
171171
my_cmd.callback._parent = user_func # type: ignore[attr-defined]
172172

173+
# If doc is present then combine it with user_func.__doc__
174+
# Otherwise override it with user_func.__doc__
175+
# if it is not empty.
173176
if doc is not None:
174-
my_cmd.help = doc
175-
my_cmd.help = (my_cmd.help or "") + "\n\n" + (user_func.__doc__ or "")
177+
my_cmd.help = doc + "\n\n" + (user_func.__doc__ or "")
178+
else:
179+
my_cmd.help = (my_cmd.help or "")
180+
if user_func.__doc__ is not None:
181+
my_cmd.help = user_func.__doc__
176182
my_cmd.help = my_cmd.help.strip()
177183

178184
my_cmd.name = user_func.__name__.replace("_", "-")

0 commit comments

Comments
 (0)