yera.cli.decorators
App-resource decorator helpers for CLI commands.
Symbols
AppResource
FlagResources that CLI commands can require or tolerate loading.
config_for
config_for(
function: Callable,
) → AppResourceReturn the application resources required by a command function.
Parameters
Command function whose resource metadata should be inspected.
Returns
The combined required-resource flags, or an empty flag when the function declares no required resources.
requires
requires(
*resources,
) → Callable[[Callable], Callable]Declare the application resources required by a CLI command.
Parameters
Resources that must be loaded before the command runs.
Returns
A decorator that attaches the required-resource metadata to a command function.
tolerates
tolerates(
*resources,
) → Callable[[Callable], Callable]Declare configuration resources whose loading failures a command tolerates.
Tolerated resources may be inspected when available, but a failure to load them does not prevent the command from running.
Parameters
Resources whose loading failures the command can tolerate.
Returns
A decorator that attaches the tolerated-resource metadata to a command function.
Raises
If a resource is declared as both required and tolerated when the returned decorator is applied.
tolerates_for
tolerates_for(
function: Callable,
) → AppResourceReturn the configuration resources tolerated by a command function.
Parameters
Command function whose resource metadata should be inspected.
Returns
The combined tolerated-resource flags, or an empty flag when the function declares no tolerated resources.