MCPcopy
hub / github.com/pallets/flask / command

Method command

src/flask/cli.py:413–427  ·  src/flask/cli.py::AppGroup.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``.

(  # type: ignore[override]
        self, *args: t.Any, **kwargs: t.Any
    )

Source from the content-addressed store, hash-verified

411 class="st">"""
412
413 def command( class="cm"># type: ignore[override]
414 self, *args: t.Any, **kwargs: t.Any
415 ) -> t.Callable[[t.Callable[..., t.Any]], click.Command]:
416 class="st">"""This works exactly like the method of the same name on a regular
417 :class:`click.Group` but it wraps callbacks in :func:`with_appcontext`
418 unless it&class="cm">#x27;s disabled by passing ``with_appcontext=False``.
419 class="st">"""
420 wrap_for_ctx = kwargs.pop(class="st">"with_appcontext", True)
421
422 def decorator(f: t.Callable[..., t.Any]) -> click.Command:
423 if wrap_for_ctx:
424 f = with_appcontext(f)
425 return super(AppGroup, self).command(*args, **kwargs)(f) class="cm"># type: ignore[no-any-return]
426
427 return decorator
428
429 def group( class="cm"># type: ignore[override]
430 self, *args: t.Any, **kwargs: t.Any

Callers 1

decoratorMethod · 0.80

Calls 1

popMethod · 0.45

Tested by

no test coverage detected