mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-10 11:35:53 +00:00
doubleclick: Push ctx for subcommands
This commit is contained in:
parent
75d4f08c25
commit
283d6f98df
1 changed files with 8 additions and 0 deletions
|
|
@ -87,6 +87,14 @@ ctx = _StackProxy(_ctx_stack)
|
|||
|
||||
def _ctx_pushing_class(cls):
|
||||
class ContextPusher(cls):
|
||||
def command(self, *args, **kwargs):
|
||||
# Also wrap commands created with @group.command()
|
||||
def decorator(f):
|
||||
cmd = click.command(*args, **kwargs)(f)
|
||||
self.add_command(cmd)
|
||||
return cmd
|
||||
return decorator
|
||||
|
||||
def invoke(self, ctx):
|
||||
_ctx_stack.push(ctx)
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue