blob: 976b4a21159caf80337b2bc637eb7634b04628c9 [file] [log] [blame]
#!/usr/bin/env python
# coding=utf-8
# Copyright [2017] [B2W Digital]
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from functools import update_wrapper
from click.decorators import pass_context
from click.decorators import command as click_command
def command(*args, **kwargs):
def wrapper(func):
@pass_context
def new_func(ctx, *args, **kwargs):
return ctx.invoke(func, ctx, *args, **kwargs)
return click_command(*args, **kwargs)(update_wrapper(new_func, func))
return wrapper