Skip to content

Add plain output to park show for pipes and redirects - #14

Merged
polymorcodeus merged 2 commits into
mainfrom
plain-show
Sep 12, 2026
Merged

polymorcodeus merged 2 commits into
mainfrom
plain-show

Conversation

@polymorcodeus

Copy link
Copy Markdown
Owner

Summary

Adds a plain-text rendering path to park show: output switches to glamour's notty style (no ANSI escapes) whenever stdout is not a terminal, and a new --plain flag forces the same behavior on a terminal. park assist applies the same rule to the note it opens after the TUI exits.

What's new

  • Auto plain on non-TTY - park show detects a non-terminal writer and renders plain text, so piped and redirected output carries no ANSI escapes.
  • --plain flag - forces plain output even on a terminal.
  • Plain header - plain mode renders a category: ... created: ... source: ... header instead of the markdown-entity header used for rich output.
  • Assist parity - the note park assist opens after the TUI exits follows the same non-terminal rule.

Usage

Command Purpose
park show <file> glamour render on a terminal, plain text when piped
park show <file> --plain force plain text output

Behavior changes / guardrails

  • Detection is writer-based: any writer that is not an *os.File (buffer, pipe) is treated as non-terminal, which keeps tests deterministic.
  • No escape hatch to force rich output when piped; piping is exactly when plain is wanted.
  • The glamour renderer cache now memoizes per style (dark and notty) under the same sharing model as before.

Testing

  • internal/render tests cover rich, plain (no ANSI, no literal &nbsp;), and missing-file paths.
  • cmd/park dispatch tests cover --plain and the auto non-TTY path.
  • make check runs fmt, vet, lint, and tests; all green.

@polymorcodeus polymorcodeus self-assigned this Sep 12, 2026
@polymorcodeus
polymorcodeus merged commit 9ec98ec into main Sep 12, 2026
4 checks passed
@polymorcodeus
polymorcodeus deleted the plain-show branch September 12, 2026 19:36
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