Skip to main content

AppGroup

This works similar to a regular click :class:~click.Group but it changes the behavior of the :meth:command decorator so that it automatically wraps the functions in :func:with_appcontext.

Methods


command()

@classmethod
def command(
*args: t.Any,
**kwargs: t.Any
) - > t.Callable[[t.Callable[..., t.Any]], click.Command]

This works exactly like the method of the same name on a regular :class:click.Group but it wraps callbacks in :func:with_appcontext unless it's disabled by passing with_appcontext=False.

Parameters

NameTypeDescription
*argst.AnyPositional arguments passed directly to the underlying Click command registration.
**kwargst.AnyKeyword arguments for command configuration; includes an optional 'with_appcontext' boolean to control automatic context wrapping.

Returns

TypeDescription
t.Callable[[t.Callable[..., t.Any]], click.Command]A decorator function that converts the decorated function into a Click command object wrapped with the application context.

group()

@classmethod
def group(
*args: t.Any,
**kwargs: t.Any
) - > t.Callable[[t.Callable[..., t.Any]], click.Group]

This works exactly like the method of the same name on a regular :class:click.Group but it defaults the group class to :class:AppGroup.

Parameters

NameTypeDescription
*argst.AnyPositional arguments passed to the Click group constructor.
**kwargst.AnyKeyword arguments for group configuration, where 'cls' defaults to AppGroup to ensure nested groups inherit context-aware behavior.

Returns

TypeDescription
t.Callable[[t.Callable[..., t.Any]], click.Group]A decorator function that converts the decorated function into a nested AppGroup instance.