repomatic.cli.repo moduleΒΆ

Repository commands of the repomatic CLI: setup, metadata and file syncs.

repomatic.cli.main.COMMANDS registers each command here, and files it under its help section.

class repomatic.cli.repo.ComponentSelector[source]ΒΆ

Bases: ParamType

Accepts bare component names or qualified component/file selectors.

Bare names (e.g., skills) select an entire component. Qualified entries (e.g., skills/repomatic-topics) select a single file within a component. Validation delegates to parse_component_entries(), the same code path the exclude and include config options go through, so the CLI and config agree on syntax and error messages.

name: str = 'selector'ΒΆ

the descriptive name of this type

get_metavar(param, ctx)[source]ΒΆ

Returns the metavar default for this param if it provides one.

Return type:

str

convert(value, param, ctx)[source]ΒΆ

Check that value names a component, or one file of a component.

Return type:

str

Returns:

The selector, unchanged.

Raises:

click.BadParameter – The selector names neither.

shell_complete(ctx, param, incomplete)[source]ΒΆ

Return a list of CompletionItem objects for the incomplete value. Most types do not provide completions, but some do, and this allows custom types to provide custom completions as well.

Parameters:
  • ctx (Context) – Invocation context for this command.

  • param (Parameter) – The parameter that is requesting completion.

  • incomplete (str) – Value being completed. May be empty.

Added in version 8.0.

Return type:

list[CompletionItem]

repomatic.cli.repo.CONFIG_REFERENCE_HEADER_DEFS: tuple[ColumnSpec, ...] = (ColumnSpec(id='option', label='Option', description='', max_width=None, optional=False, sortable=True), ColumnSpec(id='type', label='Type', description='', max_width=24, optional=False, sortable=True), ColumnSpec(id='default', label='Default', description='', max_width=24, optional=False, sortable=True), ColumnSpec(id='description', label='Description', description='', max_width=60, optional=False, sortable=True))ΒΆ

Column definitions for the [tool.repomatic] configuration reference table.

The three columns whose outliers set the whole table’s width are capped: a list[dict[str, str | bool | list[str]]] type, a list default, and a description running past a hundred characters. Option stays uncapped, because wrapping a dotted key splits an identifier mid-token. A format unable to render a wrapped cell drops the caps on its own.

repomatic.cli.repo.format_config_default(value)[source]ΒΆ

Format a Config field default for the reference table.

Return type:

str

repomatic.cli.repo.format_config_type(annotation)[source]ΒΆ

Format a type annotation for a raw GFM cell of the reference table.

Strips | None suffixes, since the default column already shows whether None is the default.

Then escapes the outer brackets of a nested generic: mdformat reads list[dict[str, str]] as a Markdown link reference, and would escape it again on every run. A simple generic like list[str] has no nested bracket and stays as is. The cell is never wrapped in backticks, where a backslash would render as itself.

Return type:

str

repomatic.cli.repo.config_reference_rows()[source]ΒΆ

The show-config table: one formatted row per [tool.repomatic] key.

Return type:

list[tuple[str, str, str, str]]

Returns:

(option, type, default, description) rows, the cells of CONFIG_REFERENCE_HEADER_DEFS.