[commands] Add Context.invoked_parents

This commit is contained in:
Sebastian Law authored and Danny committed 2021-02-23 03:39:08 -05:00
1 parent 427e387a2f
commit 1afc127458
2 files changed
+15

No files matched your search

+4
View File
@@ -1342,6 +1342,8 @@ class Group(GroupMixin, Command):
injected = hooked_wrapped_callback(self, ctx, self.callback)
await injected(*ctx.args, **ctx.kwargs)
ctx.invoked_parents.append(ctx.invoked_with)
if trigger and ctx.invoked_subcommand:
ctx.invoked_with = trigger
await ctx.invoked_subcommand.invoke(ctx)
@@ -1380,6 +1382,8 @@ class Group(GroupMixin, Command):
if call_hooks:
await self.call_after_hooks(ctx)
ctx.invoked_parents.append(ctx.invoked_with)
if trigger and ctx.invoked_subcommand:
ctx.invoked_with = trigger
await ctx.invoked_subcommand.reinvoke(ctx, call_hooks=call_hooks)