Skip to content

Comments

Add dual output mode (human/plain) with TTY auto-detection#14

Open
hev wants to merge 1 commit intomainfrom
dual-output-mode
Open

Add dual output mode (human/plain) with TTY auto-detection#14
hev wants to merge 1 commit intomainfrom
dual-output-mode

Conversation

@hev
Copy link
Owner

@hev hev commented Feb 13, 2026

Summary

  • Adds global --output/-o flag to choose between human (rich tables) and plain (pipe-delimited) output
  • Auto-detects TTY when flag is omitted: interactive terminal gets rich output, piped/redirected gets plain
  • Removes 80-char content truncation from list and search commands (fixes copy-paste of IDs and data)
  • Plain mode suppresses all decorative output (counts, emojis, performance info, colors) — data only

Files changed

File Change
src/tpuff/utils/output.py Newresolve_output_mode, is_plain, print_table_plain, status_print
src/tpuff/cli.py Add -o/--output option, store resolved mode in context
src/tpuff/commands/list.py Plain mode branch for namespace and document listing; remove truncation
src/tpuff/commands/search.py Plain mode branch for FTS and vector search; remove truncation
src/tpuff/commands/get.py Plain mode outputs raw JSON only
src/tpuff/commands/schema.py Plain mode for schema get (implicit --raw) and display_batch_summary

Plain output format

Namespace|Rows|Logical Bytes|Index Status|Unindexed Bytes|Updated
my-ns-1|1,234|45.67 MB|up-to-date|0 B|3:42 pm
my-ns-2|5,678|123.45 GB|updating|2.30 GB|Jan 15, 2026

Test plan

  • tpuff list in terminal — Rich table as before (no truncation)
  • tpuff list | cat — auto-detects non-TTY, outputs pipe-delimited
  • tpuff -o plain list — force plain mode in terminal
  • tpuff -o human list | cat — force human mode even when piped
  • tpuff -o plain search "query" -n ns --fts field — pipe-delimited search results
  • tpuff -o plain get ID -n ns — raw JSON only
  • tpuff -o plain schema get -n ns — raw JSON (same as --raw)

🤖 Generated with Claude Code

Adds a global --output/-o flag that switches between rich table output
(human) and pipe-delimited data-only output (plain). Auto-detects based
on TTY when not specified, so piping to other tools automatically gets
clean, parseable output. Also removes 80-char content truncation from
list and search commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant