formatting
formatting
Reusable formatting helpers for Festo-styled CLI output.
This module centralises Rich-markup snippets used by command help and usage messages so style choices stay consistent across multiple REPL entry points.
format_usage
Return a usage string with Festo style tags applied token-by-token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
usage
|
str
|
Plain usage text such as |
required |
Returns:
| Type | Description |
|---|---|
str
|
Rich-markup usage string where command tokens use |
str
|
arguments use |
Source code in src/applied_motion/cli/formatting.py
format_help_line
Return a single styled help line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
usage
|
str
|
Command usage text. |
required |
description
|
str
|
Optional description shown to the right of usage. |
''
|
indent
|
int
|
Two-space indentation depth. |
0
|
Returns:
| Type | Description |
|---|---|
str
|
Styled single-line help entry. |
Source code in src/applied_motion/cli/formatting.py
format_group_header
Return a styled namespace/group header line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Group name (namespace token). |
required |
description
|
str
|
Optional group description. |
''
|
indent
|
int
|
Two-space indentation depth. |
0
|
Returns:
| Type | Description |
|---|---|
str
|
Styled single-line group header. |
Source code in src/applied_motion/cli/formatting.py
format_badge
Return a compact styled badge label.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
Badge text to render. |
required |
tone
|
str
|
Badge tone name. Supported values are |
'info'
|
Returns:
| Type | Description |
|---|---|
str
|
Rich-markup badge string. |
Source code in src/applied_motion/cli/formatting.py
format_bool
Return styled yes/no/unknown marker for booleans.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool | None
|
Boolean-like value. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Styled marker string. |
Source code in src/applied_motion/cli/formatting.py
build_help_block
build_help_block(
entries: Sequence[tuple[str, str]],
*,
title: str = "Commands",
footer: Sequence[str] = (),
) -> str
Build a complete styled help block from usage-description pairs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
Sequence[tuple[str, str]]
|
Ordered |
required |
title
|
str
|
Section heading. |
'Commands'
|
footer
|
Sequence[str]
|
Additional already-styled lines to append. |
()
|
Returns:
| Type | Description |
|---|---|
str
|
Newline-joined Rich-markup block. |