Add dual output mode (human/plain) with TTY auto-detection#14
Open
Add dual output mode (human/plain) with TTY auto-detection#14
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--output/-oflag to choose betweenhuman(rich tables) andplain(pipe-delimited) outputlistandsearchcommands (fixes copy-paste of IDs and data)Files changed
src/tpuff/utils/output.pyresolve_output_mode,is_plain,print_table_plain,status_printsrc/tpuff/cli.py-o/--outputoption, store resolved mode in contextsrc/tpuff/commands/list.pysrc/tpuff/commands/search.pysrc/tpuff/commands/get.pysrc/tpuff/commands/schema.pyschema get(implicit--raw) anddisplay_batch_summaryPlain output format
Test plan
tpuff listin terminal — Rich table as before (no truncation)tpuff list | cat— auto-detects non-TTY, outputs pipe-delimitedtpuff -o plain list— force plain mode in terminaltpuff -o human list | cat— force human mode even when pipedtpuff -o plain search "query" -n ns --fts field— pipe-delimited search resultstpuff -o plain get ID -n ns— raw JSON onlytpuff -o plain schema get -n ns— raw JSON (same as--raw)🤖 Generated with Claude Code