mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +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):
|
def _ctx_pushing_class(cls):
|
||||||
class ContextPusher(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):
|
def invoke(self, ctx):
|
||||||
_ctx_stack.push(ctx)
|
_ctx_stack.push(ctx)
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue