find_work.core.cli.options#

Command line options implemented as a single object.

class find_work.core.cli.options.OptionsBase(*, children: dict[str, ~find_work.core.cli.options.OptionsBase] = <factory>)#

Bases: BaseModel, ABC

Base class for all option objects.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

children: dict[str, OptionsBase]#

Subcommand options.

abstract property attr_order: Sequence[str]#

Sequence of attributes, in order they’ll appear in breadcrumbs.

class find_work.core.cli.options.MainOptions(*, children: dict[str, ~find_work.core.cli.options.OptionsBase] = <factory>, colors: bool | None = None, verbose: bool = True, breadcrumbs: ~find_work.core.types.breadcrumbs.Breadcrumbs = <factory>, reporter_name: str = '', maintainer: str = '', category: str = '', only_installed: bool = False)#

Bases: OptionsBase

Main application options.

colors: bool | None#

Enable/disable colors.

verbose: bool#

Enable/disable progress reporting.

breadcrumbs: Breadcrumbs#

Unique predictable identificator that can be used as a cache key.

reporter_name: str#

Select a reporter to use for output.

maintainer: str#

Display only packages for given maintainer email.

category: str#

Display only packages in the given category.

only_installed: bool#

Display installed packages only.

override(opt_module: str, opt_name: str, value: Any) None#

Override an option in one of the children.

Parameters:
  • opt_module – “path” to the OptionsBase object

  • opt_name – target option name

  • value – new value

get_reporter_for(result_type: type) AbstractReporter#

Get a reporter to output results.

Parameters:

result_type – result type (class) to represent

Returns:

reporter instance to use in a context manager

Raises:

RuntimeError – when no suitable reporters found

static echo(message: Any | None = None, **kwargs: Any) None#

Simple alias to click.echo().

vecho(message: Any | None = None, **kwargs: Any) None#

Alias to click.echo() but with our verbosity settings.

secho(message: Any | None = None, **kwargs: Any) None#

Alias to click.secho() but with our color settings.

exit(result: Result) None#

Display a result message to stderr.

Parameters:

result – result message

property attr_order: Sequence[str]#

Sequence of attributes, in order they’ll appear in breadcrumbs.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].