17 lines
407 B
Python
17 lines
407 B
Python
from rich.text import Text
|
|
|
|
CACHED = "cached"
|
|
PARTIAL = "partial"
|
|
MISSING = "missing"
|
|
STATE_STYLES = {CACHED: "green", PARTIAL: "yellow", MISSING: "red"}
|
|
|
|
|
|
def cache_state(has_details: bool, has_local_image: bool) -> str:
|
|
if not has_details:
|
|
return MISSING
|
|
return CACHED if has_local_image else PARTIAL
|
|
|
|
|
|
def cache_text(state: str) -> Text:
|
|
return Text(state, style=STATE_STYLES[state])
|