CLI

Command-line interface modules.

Main Entry Point

Command-line interface main entry point for numistalib.

Registers all CLI command groups.

numistalib.cli.main.main() None[source]

Register all command groups and run CLI.

Types Commands

Types CLI commands.

numistalib.cli.types.register_types_commands(parent: Group) None[source]

Register types commands with parent group.

Catalogues Commands

Catalogues CLI commands.

numistalib.cli.catalogues.register_catalogues_commands(parent: Group) None[source]

Register catalogues commands with parent group.

Parameters:

parent (click.Group) – Parent click group to attach commands to

Issuers Commands

Issuers CLI commands.

numistalib.cli.issuers.register_issuers_commands(parent: Group) None[source]

Register issuers commands with parent group.

Parameters:

parent (click.Group) – Parent click group to attach commands to

Issues Commands

Issues CLI commands.

numistalib.cli.issues.register_issues_commands(parent: Group) None[source]

Register issues commands with parent group.

Parameters:

parent (click.Group) – Parent click group to attach commands to

Mints Commands

Mints CLI commands.

numistalib.cli.mints.register_mints_commands(parent: Group) None[source]

Register mints commands with parent group.

Parameters:

parent (click.Group) – Parent click group to attach commands to

Collections Commands

Collections CLI commands.

numistalib.cli.collections.register_collections_commands(parent: Group) None[source]

Register collections commands with parent group.

Parameters:

parent (click.Group) – Parent click group to attach commands to

Literature Commands

Literature CLI commands.

numistalib.cli.literature.register_literature_commands(parent: Group) None[source]

Register literature commands with parent group.

Parameters:

parent (click.Group) – Parent click group to attach commands to

Prices Commands

Prices CLI commands.

numistalib.cli.prices.register_prices_commands(parent: Group) None[source]

Register prices commands with parent group.

Parameters:

parent (click.Group) – Parent click group to attach commands to

Users Commands

Users CLI commands.

numistalib.cli.users.register_users_commands(parent: Group) None[source]

Register users commands with parent group.

Parameters:

parent (click.Group) – Parent click group to attach commands to

Config Commands

Configuration management CLI commands.

numistalib.cli.config.register_config_commands(parent: Group) None[source]

Register config commands with parent group.

Parameters:

parent (click.Group) – Parent click group to attach commands to

Theme

Rich v14 theming and formatting utilities for numistalib CLI.

Provides consistent theming, console access, table helpers, and panel formatting in line with AGENTS.md § 7.1 requirements.

class numistalib.cli.theme.CLISettings[source]

Centralized CLI styling and formatting utilities.

Provides: - Rich v14 theme configuration - Console access (cached singleton) - Table/panel helpers following § 7.1 patterns - Field truncation constants for general UI

Note: Domain-specific truncation (e.g., biography length, issuer name length) lives in individual model classes per § 5.4 distributed settings strategy.

CLI_THEME: ClassVar[dict[str, str]] = {'cache_hit': 'dim green', 'cache_miss': 'dim yellow', 'current_currency': 'bold green', 'danger': 'bold bright_red', 'debug': 'dim magenta', 'demonetized': 'bold red', 'error': 'bright_red', 'footer': 'dim white', 'header': 'bold bright_blue', 'info': 'bright_cyan', 'key': 'bold white', 'label': 'bold bright_blue', 'link': 'underline bright_cyan', 'link_hover': 'bold underline bright_cyan', 'panel_danger': 'bright_red', 'panel_default': 'bright_blue', 'panel_info': 'bright_cyan', 'panel_success': 'bright_green', 'panel_warning': 'bright_yellow', 'row_data': 'white', 'row_emphasized': 'bold bright_cyan', 'row_even': 'white', 'row_metadata': 'dim white', 'row_odd': 'bright_white', 'subheader': 'bold cyan', 'success': 'bold bright_green', 'table_header': 'bold bright_blue on grey15', 'tag': 'reverse black on bright_white', 'tag_banknote': 'reverse black on bright_green', 'tag_coin': 'reverse black on bright_yellow', 'tag_exonumia': 'reverse black on bright_magenta', 'value': 'white', 'value_dim': 'dim white', 'value_highlight': 'bold bright_cyan', 'value_missing': 'dim italic', 'warning': 'bold bright_yellow'}
FIELD_TRUNCATE_LENGTH: int = 100
FIELD_TRUNCATE_SUFFIX: str = '…'
LICENSE_TEXT: str = 'MIT License - See LICENSE file for details'
PADDING_DIMENSIONS: tuple[int, int] = (1, 1)
PANEL_BOX_STYLE: Box = Box(...)
PANEL_HIGHLIGHT: bool = True
PANEL_TITLE_ALIGN: Literal['left', 'center', 'right'] = 'left'
PANEL_WIDTH: int = 120
TABLE_BOX_STYLE: Box = Box(...)
TABLE_EXPAND: bool = True
TABLE_HIGHLIGHT: bool = True
TABLE_SHOW_HEADER: bool = True
TABLE_SHOW_TITLE: bool = False
VERSION: str = '0.1.1'
classmethod add_columns_to_table(table: Table, columns: Iterable[str]) None[source]

Add columns with appropriate styling based on semantic meaning.

classmethod add_model_row(table: Table, model_instance: BaseModel, cache_indicator: str = '') None[source]

Add a row from a Pydantic model instance, respecting column order.

classmethod console() Console[source]

Return a Console instance with CLI theme applied (cached singleton).

classmethod create_table(title: str | None = None, include_cache_column: bool = False) Table[source]

Create a consistently styled table.

classmethod format_detail_field(label: str, value: Any) str[source]

Format a single detail field (wrapper around base formatting).

Parameters:
  • label (str) – Field label/key

  • value (Any) – Field value

Returns:

Formatted field string

Return type:

str

classmethod format_detail_fields(field_list: list[tuple[str, Any]]) str[source]

Format multiple detail fields (wrapper for consistent CLI usage).

Parameters:

field_list (list[tuple[str, Any]]) – List of (label, value) tuples

Returns:

Newline-joined formatted fields

Return type:

str

classmethod infer_columns_from_model(model_cls: type[BaseModel], include_cache: bool = False) list[str][source]

Infer concise column names from a Pydantic model.

Uses short, humanized field names instead of verbose descriptions. This prevents overly long headers when model field descriptions contain detailed documentation.

classmethod panel(content: str | Any, *, title: str | None = None, box: Box | None = None, padding: tuple[int, int] | None = None, width: int | None = None, expand: bool | None = None, title_align: Literal['left', 'center', 'right'] | None = None, **kwargs: Any) Panel[source]

Create a consistently styled Panel.

classmethod theme() Theme[source]

Return the configured CLI theme (cached).

classmethod version_info() str[source]

Return formatted version string.