Skip to content

Context

ContextObject

resolve_alias(self, name)

tries to resolve the given alias if not found returns none

Source code in camundactl/cmd/context.py
def resolve_alias(self, name: str) -> Optional[str]:
    """
    tries to resolve the given alias if not
    found returns none
    """
    config = self.get_config()
    try:
        return config["alias"][name]
    except KeyError:
        return None

ensure_object()

a command decorator which ensures the context object to be created

Source code in camundactl/cmd/context.py
def ensure_object():
    """
    a command decorator which ensures the context object to be created
    """

    def inner(func):
        if _is_bound_method(func):

            @wraps(func)
            def wrapper_bound(self_or_cls, ctx: click.Context, *args, **kwargs):
                ctx.ensure_object(ContextObject)
                return func(self_or_cls, ctx, *args, **kwargs)

            return wrapper_bound

        @wraps(func)
        def wrapper(ctx: click.Context, *args, **kwargs):
            ctx.ensure_object(ContextObject)
            return func(ctx, *args, **kwargs)

        return wrapper

    return inner