CLI
Command-line interface modules.
Main Entry Point
Command-line interface main entry point for numistalib.
Registers all CLI command groups.
Types Commands
Types CLI commands.
Catalogues Commands
Catalogues CLI commands.
Issuers Commands
Issuers CLI commands.
Issues Commands
Issues CLI commands.
Mints Commands
Mints CLI commands.
Collections Commands
Collections CLI commands.
Image Search Commands
Image search CLI commands.
Literature Commands
Literature CLI commands.
Prices Commands
Prices CLI commands.
Users Commands
Users CLI commands.
Config Commands
Configuration management CLI commands.
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'}
- PANEL_BOX_STYLE: Box = Box(...)
- TABLE_BOX_STYLE: Box = Box(...)
- 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).
- 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:
- 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.