argclz.dispatch.core.BoundDispatchGroup#

class argclz.dispatch.core.BoundDispatchGroup[source]#

Bases: NamedTuple

BoundDispatchGroup(zelf, group)

__init__()#

Methods Summary

__init__()

find_command(command)

find dispatch() function according to command in this group.

invoke_command(command, *args, **kwargs)

invoke a dispatch() function in this group.

list_commands(*[, all])

list all dispatch() info in this group.

Attributes Summary

group

Alias for field number 1

zelf

Alias for field number 0

Details

zelf: Dispatch | Type[Dispatch]#

Alias for field number 0

group: str#

Alias for field number 1

list_commands(*, all=False)[source]#

list all dispatch() info in this group.

Parameters:

all (bool) – including hidden commands

Returns:

list of DispatchCommand

Return type:

list[DispatchCommand]

find_command(command)[source]#

find dispatch() function according to command in this group.

Parameters:

command (str) – command or one of command’s aliases

Returns:

found DispatchCommand

Return type:

DispatchCommand | None

invoke_command(command, *args, **kwargs)[source]#

invoke a dispatch() function in this group.

Parameters:
  • command (str) – command or one of command’s aliases :param args: positional arguments of the target function

  • kwargs – keyword arguments of the target function

Returns:

function’s return

Raises:

DispatchCommandNotFound

Return type:

Any