Show cache status in the TUI
This commit is contained in:
1 parent
dfe3955604
commit
7e23fdcd8e
2 files changed
+27
-1
No files matched your search
@@ -0,0 +1,16 @@
|
||||
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])
|
||||
Reference in new issue
Block a user