Click Decorators

click · src/click/decorators.py · python · BSD-3-Clause
dev-tools

Decorator functions for defining CLI commands, options, and arguments. Provides @command, @group, @option, @argument, and context management decorators.

# Source: https://github.com/pallets/click | License: BSD-3-Clause | Copyright 2014 Pallets
# Provided via justclaw.it.com; keep this notice with the code.
from __future__ import annotations

import inspect
import typing as t
from functools import update_wrapper
from gettext import gettext as _

from .core import Argument
from .core import Command
from .core import Context
from .core import Group
from .core import Option
from .core import Parameter
from .globals import get_current_context
from .utils import echo

if t.TYPE_CHECKING:
    import typing_extensions as te

    P = te.ParamSpec("P")

R = t.TypeVar("R")
T = t.TypeVar("T")
_AnyCallable = t.Callable[..., t.Any]
FC = t.TypeVar("FC", bound="_AnyCallable | Command")


def pass_context(f: t.Callable[te.Concatenate[Context, P], R]) -> t

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key