Skip to content

Context

BaseContext

The context object passed to every command via pass_cli_context. Composites RichHelpersMixin and OutputFormatMixin to expose Rich console helpers and output dispatching.

pyclif.BaseContext

Bases: RichHelpersMixin, OutputFormatMixin

BaseContext class initializes state and combines output and rich helpers for CLI commands.

Source code in src/pyclif/core/context.py
class BaseContext(RichHelpersMixin, OutputFormatMixin):
    """BaseContext class initializes state and combines output and rich helpers for CLI commands."""

    def __init__(self):
        """Initialize the context with a console and detect TTY mode."""
        self.console = Console()
        self.is_atty = sys.stdout.isatty()
        self.output_format = None

__init__()

Initialize the context with a console and detect TTY mode.

Source code in src/pyclif/core/context.py
def __init__(self):
    """Initialize the context with a console and detect TTY mode."""
    self.console = Console()
    self.is_atty = sys.stdout.isatty()
    self.output_format = None