Functions
strip_ansi
1
str
▼
Return *value* as text with ANSI SGR/control sequences removed.
strip_ansi
1
str
▼
def strip_ansi(value: object) -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
Returns
str
cell_width
1
int
▼
Return the terminal display-cell width of *value*.
This intentionally implemen…
cell_width
1
int
▼
def cell_width(value: object) -> int
Return the terminal display-cell width of value.
This intentionally implements the common wcwidth behavior we need without adding a runtime dependency: combining/control characters are zero-width, fullwidth/wide East Asian characters are two cells, and ambiguous-width symbols are treated as one cell for Western terminal defaults.
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
Returns
int
cell_ljust
3
str
▼
Left-justify *value* to display-cell *width*.
cell_ljust
3
str
▼
def cell_ljust(value: object, width: int, fill: str = ' ') -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
|
width |
int |
|
fill |
str |
Default:' '
|
Returns
str
cell_rjust
3
str
▼
Right-justify *value* to display-cell *width*.
cell_rjust
3
str
▼
def cell_rjust(value: object, width: int, fill: str = ' ') -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
|
width |
int |
|
fill |
str |
Default:' '
|
Returns
str
cell_truncate
3
str
▼
Truncate *value* to display-cell *width*, preserving ANSI-free text.
cell_truncate
3
str
▼
def cell_truncate(value: object, width: int, marker: str = '…') -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
|
width |
int |
|
marker |
str |
Default:'…'
|
Returns
str
cell_fit
4
str
▼
Truncate then left-pad *value* so it occupies exactly *width* cells.
cell_fit
4
str
▼
def cell_fit(value: object, width: int, fill: str = ' ', marker: str = '…') -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
|
width |
int |
|
fill |
str |
Default:' '
|
marker |
str |
Default:'…'
|
Returns
str
cell_fill
2
str
▼
Return *fill* repeated/truncated to exactly *width* display cells.
cell_fill
2
str
▼
def cell_fill(width: int, fill: str = ' ') -> str
Parameters
| Name | Type | Description |
|---|---|---|
width |
int |
|
fill |
str |
Default:' '
|
Returns
str
_rule_tail
3
str
▼
Return a fixed-width rule that fades instead of ending abruptly.
_rule_tail
3
str
▼
def _rule_tail(width: int, fill: str = '─', tail: str = '╌┄') -> str
Parameters
| Name | Type | Description |
|---|---|---|
width |
int |
|
fill |
str |
Default:'─'
|
tail |
str |
Default:'╌┄'
|
Returns
str
rule_line
6
str
▼
Return a display-cell exact horizontal rule.
rule_line
6
str
▼
def rule_line(value: object = '', width: int = 78, left: str = '╭', right: str = '╮', fill: str = '─', tail: str = '') -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
Default:''
|
width |
int |
Default:78
|
left |
str |
Default:'╭'
|
right |
str |
Default:'╮'
|
fill |
str |
Default:'─'
|
tail |
str |
Default:''
|
Returns
str
divider_line
2
str
▼
Return a display-cell exact closed-box divider.
divider_line
2
str
▼
def divider_line(value: object = '', width: int = 78) -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
Default:''
|
width |
int |
Default:78
|
Returns
str
bottom_rule
2
str
▼
Return a display-cell exact closed-box bottom rule.
bottom_rule
2
str
▼
def bottom_rule(value: object = '', width: int = 78) -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
Default:''
|
width |
int |
Default:78
|
Returns
str
frame_line
4
str
▼
Return a display-cell exact framed content row.
frame_line
4
str
▼
def frame_line(value: object = '', width: int = 78, left: str = '│', right: str = '│') -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
Default:''
|
width |
int |
Default:78
|
left |
str |
Default:'│'
|
right |
str |
Default:'│'
|
Returns
str
rail_line
3
str
▼
Return a display-cell exact open-card row with one left rail.
rail_line
3
str
▼
def rail_line(value: object = '', width: int = 78, rail: str = '│') -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
Default:''
|
width |
int |
Default:78
|
rail |
str |
Default:'│'
|
Returns
str
open_rule
3
str
▼
Return a cell-width exact open-card rule with a fading right edge.
open_rule
3
str
▼
def open_rule(value: object = '', width: int = 78, corner: str = '╭') -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
Default:''
|
width |
int |
Default:78
|
corner |
str |
Default:'╭'
|
Returns
str
open_rule_divider
2
str
▼
Return a cell-width exact open-card section divider.
open_rule_divider
2
str
▼
def open_rule_divider(value: object = '', width: int = 78) -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
Default:''
|
width |
int |
Default:78
|
Returns
str
open_rule_end
2
str
▼
Return a cell-width exact open-card bottom rule.
open_rule_end
2
str
▼
def open_rule_end(value: object = '', width: int = 78) -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
object |
Default:''
|
width |
int |
Default:78
|
Returns
str
cell_meter
5
str
▼
Return a display-cell exact meter.
cell_meter
5
str
▼
def cell_meter(value: int, total: int, width: int = 10, filled: str = '█', empty: str = '░') -> str
Parameters
| Name | Type | Description |
|---|---|---|
value |
int |
|
total |
int |
|
width |
int |
Default:10
|
filled |
str |
Default:'█'
|
empty |
str |
Default:'░'
|
Returns
str