fix: list command shows Claude titles and fits 80-col terminals
Claude's list endpoint returns conversations with a `name` field rather than `title`, so every Claude row was falling through to "Untitled". Also set no_wrap + ellipsis overflow and tune column widths so the table renders one row per conversation in Windows Command Prompt (80 cols). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
22
src/main.py
22
src/main.py
@@ -800,18 +800,26 @@ def list_conversations(ctx: click.Context, provider: str, project_filter: str |
|
||||
if project_filter is not None:
|
||||
all_convs = _filter_by_project(all_convs, project_filter)
|
||||
|
||||
table = Table()
|
||||
table.add_column("Title")
|
||||
table.add_column("Project")
|
||||
table.add_column("Updated")
|
||||
table.add_column("ID")
|
||||
# no_wrap + overflow="ellipsis" prevents Rich from wrapping cells to
|
||||
# multiple lines on narrow terminals (e.g. Windows Command Prompt),
|
||||
# which can otherwise make the output look garbled. Widths are tuned
|
||||
# to fit within an 80-column terminal.
|
||||
# Total width budget for 80-column terminals:
|
||||
# borders (5) + padding (4 cols * 2) = 13 chars of overhead
|
||||
# remaining 67 chars split: 34 title + 15 project + 10 date + 8 id
|
||||
table = Table(show_lines=False, expand=False, padding=(0, 1))
|
||||
table.add_column("Title", no_wrap=True, overflow="ellipsis", max_width=34)
|
||||
table.add_column("Project", no_wrap=True, overflow="ellipsis", max_width=15)
|
||||
table.add_column("Updated", no_wrap=True, min_width=10)
|
||||
table.add_column("ID", no_wrap=True, min_width=8)
|
||||
|
||||
for conv in all_convs:
|
||||
title = conv.get("title") or "Untitled"
|
||||
# ChatGPT uses "title"; Claude uses "name".
|
||||
title = conv.get("title") or conv.get("name") or "Untitled"
|
||||
project = _raw_project_name(conv) or ""
|
||||
updated = (conv.get("updated_at") or conv.get("update_time") or "")[:10]
|
||||
conv_id = (conv.get("id") or conv.get("uuid") or "")[:8]
|
||||
table.add_row(title[:60], project[:30], updated, conv_id)
|
||||
table.add_row(title, project, updated, conv_id)
|
||||
|
||||
console.print(table)
|
||||
console.print(f"Total: {len(all_convs)} conversations")
|
||||
|
||||
Reference in New Issue
Block a user