Skip to content

feat(gmail): add --full flag to messages search to disable body truncation#447

Open
GodsBoy wants to merge 1 commit intosteipete:mainfrom
GodsBoy:feat/gmail-messages-full-body
Open

feat(gmail): add --full flag to messages search to disable body truncation#447
GodsBoy wants to merge 1 commit intosteipete:mainfrom
GodsBoy:feat/gmail-messages-full-body

Conversation

@GodsBoy
Copy link

@GodsBoy GodsBoy commented Mar 13, 2026

Problem

gog gmail messages search "query" --include-body truncates message bodies to 200 characters in plain-text output. For longer emails this cuts off important content, forcing users to pipe through --json and manually extract the body field.

The gmail thread get command (gog gmail read) already has a --full flag that disables its 500-character truncation, but the messages search command has no equivalent.

Solution

Add a --full flag to GmailMessagesSearchCmd that:

  • Skips the 200-character truncation in sanitizeMessageBody
  • Implies --include-body (so --full alone is sufficient)
  • Preserves existing behaviour when --full is not passed

Usage

# Before: body truncated at 200 chars
gog gmail messages search "invoice" --include-body

# After: full body in plain-text output
gog gmail messages search "invoice" --full

Testing

  • Added TestSanitizeMessageBody_FullSkipsTruncation test verifying full bodies are preserved
  • Updated existing tests for the new function signature
  • All tests pass (make test)
  • Build passes (make build)
  • Lint has one pre-existing nilnil issue in gmail_filters_helpers.go (present on main, not introduced by this PR)

Changes

  • internal/cmd/gmail_messages.go: Add Full field, thread it through to sanitizeMessageBody
  • internal/cmd/gmail_messages_test.go: Add full-body test, update existing test signatures

…ation

The --full flag skips the 200-character body truncation in plain-text
output. It implies --include-body, so passing --full alone is enough.

The gmail thread get command (gog gmail read) already had this flag;
this brings parity to the messages search command.
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