File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,11 @@ def introspect(*, cmd):
2929
3030 cmd_func = cmds [cmd ]
3131 try :
32- code = inspect .getsource (cmd_func .callback )
32+ if hasattr (cmd_func .callback , "_parent" ):
33+ # `util.extend_command` was used
34+ code = inspect .getsource (cmd_func .callback ._parent )
35+ else :
36+ code = inspect .getsource (cmd_func .callback )
3337 except TypeError :
3438 # Perhaps a partial, try again
3539 code = inspect .getsource (cmd_func .callback .func )
Original file line number Diff line number Diff line change @@ -160,6 +160,7 @@ def parent_cmd(*user_args, **user_kwargs):
160160 return user_func (* args , parent_callback = parent_cmd , ** kwargs )
161161
162162 my_cmd .callback = click .pass_context (callback_with_parent_callback )
163+ my_cmd .callback ._parent = user_func
163164
164165 if doc is not None :
165166 my_cmd .help = doc
You can’t perform that action at this time.
0 commit comments