This commit is contained in:
2026-01-12 20:33:14 -08:00
parent 8b7f518725
commit b5247936a4
5 changed files with 39 additions and 33 deletions

View File

@@ -101,7 +101,20 @@ class Get_Note(Cmdlet):
store_registry = Store(config)
any_notes = False
display_items: List[Dict[str, Any]] = []
note_table: Optional[ResultTable] = None
# We assume single subject for get-note detail view
main_res = results[0]
from SYS.result_table import ItemDetailView, extract_item_metadata
metadata = extract_item_metadata(main_res)
note_table = (
ItemDetailView("Notes", item_metadata=metadata)
.set_table("note")
.set_value_case("preserve")
.set_preserve_order(True)
)
note_table.set_source_command("get-note", [])
for res in results:
if not isinstance(res, dict):
@@ -125,6 +138,12 @@ class Get_Note(Cmdlet):
)
if not resolved_hash:
continue
# Update metadata if we resolved a hash that wasn't in source
if resolved_hash and not metadata.get("Hash"):
metadata["Hash"] = resolved_hash
if store_name and not metadata.get("Store"):
metadata["Store"] = store_name
try:
backend = store_registry[store_name]
@@ -148,13 +167,6 @@ class Get_Note(Cmdlet):
continue
any_notes = True
if note_table is None:
note_table = (
ResultTable("note")
.set_table("note")
.set_value_case("preserve")
.set_preserve_order(True)
)
# Emit each note as its own row so CLI renders a proper note table
for k in sorted(notes.keys(), key=lambda x: str(x).lower()):
v = notes.get(k)
@@ -176,13 +188,18 @@ class Get_Note(Cmdlet):
}
display_items.append(payload)
if note_table is not None:
note_table.add_result(payload)
row = note_table.add_row()
row.add_column("Name", str(k))
row.add_column("Text", preview.strip())
ctx.emit(payload)
# Always set the table overlay even if empty to show item details
ctx.set_last_result_table_overlay(note_table, display_items, subject=result)
if not any_notes:
ctx.emit("No notes found.")
elif note_table is not None:
ctx.set_last_result_table(note_table, display_items, subject=result)
log("No notes found.")
return 0

View File

@@ -499,20 +499,6 @@ def _run(result: Any, _args: Sequence[str], config: Dict[str, Any]) -> int:
if not found_relationships:
log(f"Hydrus relationships fetch failed: {exc}", file=sys.stderr)
if not found_relationships:
try:
from rich.panel import Panel
from SYS.rich_display import stdout_console
title = source_title or (hash_hex[:16] + "..." if hash_hex else "Item")
stdout_console().print(
Panel(f"{title} has no relationships",
title="Relationships")
)
except Exception:
log("No relationships found.")
return 0
# Display results
from SYS.result_table import ItemDetailView, extract_item_metadata
@@ -580,11 +566,15 @@ def _run(result: Any, _args: Sequence[str], config: Dict[str, Any]) -> int:
f"hash:{item['hash']}"]
)
ctx.set_last_result_table(table, pipeline_results)
# Ensure empty state is still navigable/visible
ctx.set_last_result_table_overlay(table, pipeline_results)
from SYS.rich_display import stdout_console
stdout_console().print(table)
if not found_relationships:
log("No relationships found.")
return 0

View File

@@ -1753,10 +1753,7 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
storage = Store(config)
backend = storage[store_name]
current, source = backend.get_tag(file_hash, config=config)
if not current:
log("No tags found", file=sys.stderr)
return 1
current = list(current or [])
service_name = ""
except KeyError:

View File

@@ -453,13 +453,14 @@ class Get_Url(Cmdlet):
# Use overlay mode to avoid "merging" with the previous status/table state.
# This is idiomatic for detail views and prevents the search table from being
# contaminated by partial re-renders.
ctx.set_last_result_table_overlay(table if items else None, items, subject=result)
ctx.set_last_result_table_overlay(table, items, subject=result)
# Emit items at the end for pipeline continuity
for item in items:
ctx.emit(item)
if not items:
# Still log it but the panel will show the item context
log("No url found", file=sys.stderr)
return 0