ocebuild.cli._lib#

Shared CLI utilities.

Module Contents#

Classes#

CLIEnv

Shared CLI environment.

Functions#

cli_command([name])

Factory for creating a shared environment for CLI commands.

Attributes#

CONTEXT_SETTINGS

Shared context settings for the CLI.

ocebuild.cli._lib.CONTEXT_SETTINGS[source]#

Shared context settings for the CLI.

class ocebuild.cli._lib.CLIEnv(verbose_flag: bool = VERBOSE, debug_flag: bool = DEBUG)[source]#

Shared CLI environment.

__setattr__(name: str, value: any) None[source]#

Sets an attribute on the CLI environment.

ocebuild.cli._lib.cli_command(name: str | None = None)[source]#

Factory for creating a shared environment for CLI commands.

Parameters:

name – The name of the command. Defaults to the function name.

Returns:

A decorator for passing the CLI environment to commands.

Example

>>> @cli_command()
... def cli(env, *args, **kwargs):
...   print(env)
# -> <ocebuild.cli._lib.CLIEnv object at 0x108bf73d0>