Skip to content

Get

OpenAPIMulitCommandBase (MultiCommand)

get_command(self, ctx, name)

returns the command object by the given name. if the operation based on the given name could not be found, this method returns none.

Parameters:

Name Type Description Default
ctx Context

the click context.

required
name str

the commands name.

required
Source code in camundactl/cmd/get.py
@ensure_object()
def get_command(self, ctx: click.Context, name: str) -> Optional[click.Command]:
    """
    returns the command object by the given name. if the operation
    based on the given name could not be found, this method returns none.

    Args:
        ctx: the click context.
        name: the commands name.
    """
    spec = ctx.obj.get_spec()
    cache: OpenAPISpecCache = ctx.obj.get_spec_cache()
    if alias := ctx.obj.resolve_alias(name):
        name = alias
    operation_id: str = cast(str, from_command_name(name, prefix=self.verb))
    if not cache.has_operation_id(operation_id):
        if not cache.has_operation_id(name):
            return None
        operation_id = name
    factory = self._get_or_create_factory(spec, cache)
    method = self.get_factory_method(factory)
    return method(operation_id=operation_id)

list_commands(self, ctx)

returns a list of commands based on the operation ids the verb for this class.

Parameters:

Name Type Description Default
ctx Context

the click context.

required
Source code in camundactl/cmd/get.py
@ensure_object()
def list_commands(self, ctx: click.Context) -> List[str]:
    """
    returns a list of commands based on the operation ids the verb
    for this class.

    Args:
        ctx: the click context.
    """
    cache: OpenAPISpecCache = ctx.obj.get_spec_cache()
    op_ids = cache.get_operation_ids_by_verb(self.verb)
    command_names = list(map(to_command_name(prefix=self.verb), op_ids))
    return sorted(command_names)