Decorators
provide.foundation.cli.decorators
¶
TODO: Add module docstring.
Classes¶
Functions¶
config_options
¶
Add configuration file options to a Click command.
Adds: - --config/-c: Path to configuration file - --profile/-p: Configuration profile to use
Source code in provide/foundation/cli/decorators.py
error_handler
¶
Decorator to handle errors consistently in CLI commands.
Catches exceptions and formats them appropriately based on debug mode and output format.
Source code in provide/foundation/cli/decorators.py
flexible_options
¶
Apply flexible CLI options that can be used at any command level.
Combines logging_options and config_options for consistent control at both group and command levels.
Source code in provide/foundation/cli/decorators.py
logging_options
¶
Add standard logging options to a Click command.
Adds: - --log-level/-l: Set logging verbosity (TRACE, DEBUG, INFO, WARNING, ERROR, CRITICAL) - --log-file: Write logs to file - --log-format: Choose log output format (json, text, key_value)
Source code in provide/foundation/cli/decorators.py
output_options
¶
Add output formatting options to a Click command.
Adds: - --json: Output in JSON format - --no-color: Disable colored output - --no-emoji: Disable emoji in output
Source code in provide/foundation/cli/decorators.py
pass_context
¶
Decorator to pass the foundation CLIContext to a command.
Creates or retrieves a CLIContext from Click's context object and passes it as the first argument to the decorated function.
Source code in provide/foundation/cli/decorators.py
standard_options
¶
Apply all standard CLI options.
Combines logging_options, config_options, and output_options.
version_option
¶
Add a --version option to display version information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str | None
|
Version string to display |
None
|
prog_name
|
str | None
|
Program name to display |
None
|