topmark.cli.option_meta¶
CLI option metadata helpers.
This module contains small, parser-adjacent metadata used by TopMark-owned
validation and diagnostic rendering. Click option declarations remain in
topmark.cli.options; this module must not become a second parser model.
CLI_OPTION_META_BY_LONG
module-attribute
¶
CLI_OPTION_META_BY_LONG = {
INCLUDE_FILE_TYPES: CliOptionMeta(
long=INCLUDE_FILE_TYPES,
short=INCLUDE_FILE_TYPES,
hidden_aliases=(INCLUDE_FILE_TYPE,),
),
EXCLUDE_FILE_TYPES: CliOptionMeta(
long=EXCLUDE_FILE_TYPES,
short=EXCLUDE_FILE_TYPES,
hidden_aliases=(EXCLUDE_FILE_TYPE,),
),
VERBOSE: CliOptionMeta(long=VERBOSE, short=VERBOSE),
QUIET: CliOptionMeta(long=QUIET, short=QUIET),
}
Known CLI option metadata keyed by canonical long spelling.
CLI_HIDDEN_ALIAS_TARGETS
module-attribute
¶
Hidden compatibility aliases keyed by alias spelling.
CliOptionMeta
dataclass
¶
Human-facing metadata for one CLI option spelling.
Attributes:
| Name | Type | Description |
|---|---|---|
long |
str
|
Canonical long option spelling. |
short |
str | None
|
Optional short alias spelling. |
hidden_aliases |
tuple[str, ...]
|
Compatibility aliases accepted by Click but hidden from help. |
label ¶
Return the option label used in human-facing diagnostics.
Returns:
| Type | Description |
|---|---|
str
|
The canonical long spelling, followed by the short alias when available. |
Source code in src/topmark/cli/option_meta.py
format_option_label ¶
Return a user-facing option label, including a short alias when known.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
option
|
str
|
Option spelling to render. Hidden aliases are resolved to their canonical long spelling before rendering. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Human-facing option label for diagnostics. |
Source code in src/topmark/cli/option_meta.py
format_option_labels ¶
Return user-facing option labels for a list of option spellings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
options
|
list[str]
|
Option spellings to render. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Rendered labels in the same order as the provided option spellings. |