Skip to content

feat: add --quote flag to include original message in replies#169

Merged
steipete merged 8 commits intoopenclaw:mainfrom
terry-li-hm:feat/quote-original-message
Feb 14, 2026
Merged

feat: add --quote flag to include original message in replies#169
steipete merged 8 commits intoopenclaw:mainfrom
terry-li-hm:feat/quote-original-message

Conversation

@terry-li-hm
Copy link
Copy Markdown
Contributor

@terry-li-hm terry-li-hm commented Feb 3, 2026

Adds a --quote flag to gog gmail send that automatically quotes the original message when replying, with proper Gmail rendering.

Features

  • Plain text quote: Adds > prefixed lines for plain text email clients
  • HTML blockquote: Generates proper Gmail-style <blockquote> with blue left border
  • Preserves formatting: Original email's HTML formatting (links, bold, images) is preserved in the quote
  • Attribution line: "On , wrote:" header above the quote

Usage

gog gmail send \
  --reply-to-message-id=<id> \
  --quote \
  --to=someone@example.com \
  --subject="Re: Topic" \
  --body="My reply here"

How it works

  1. Fetches original message with full body (both plain text and HTML)
  2. Appends plain text quote with > prefix to --body
  3. Generates HTML with user's body + <blockquote> containing original HTML
  4. Gmail renders the HTML version with proper quote styling

Changes

  • Added --quote flag to GmailSendCmd struct
  • Extended replyInfo to include BodyHTML for preserving original formatting
  • Modified fetchReplyInfo to fetch full message body when quoting
  • Added formatQuotedMessage() for plain text quotes
  • Added formatQuotedMessageHTML() and formatQuotedMessageHTMLWithContent() for HTML quotes
  • Auto-generates HTML body when --quote is used (even without --body-html)

Testing

  • go test ./internal/cmd/... -run 'Send|Reply' - all tests pass
  • Manually tested with real Gmail - quote renders with blue left border and preserved formatting

OpenCode and others added 8 commits February 3, 2026 16:16
Adds a --quote flag to gog gmail send that automatically quotes the original message when replying.

Changes:
- Added --quote flag to GmailSendCmd struct
- Modified fetchReplyInfo to optionally fetch message body
- Added formatQuotedMessage function for attribution and quoting
- Updated validation to require reply target when --quote is used
Add automatic message quoting when replying to emails. The new --quote flag
includes the original message body with proper attribution line and quote
prefixes when using --reply-to-message-id or --thread-id.

Changes:
- Add Quote bool flag to GmailSendCmd struct
- Validate --quote requires reply target (--reply-to-message-id or --thread-id)
- Modify fetchReplyInfo to support fetching full message format for quoting
- Add Date and Body fields to replyInfo struct
- Add formatQuotedMessage function to format original message as quote
- Append quoted message to user's body when --quote is set
- Update test calls to replyInfoFromMessage with new includeBody parameter
- Use gmailFormatFull/gmailFormatMetadata constants instead of string literals
- Use body += for appending instead of body = body +
- Quote now works when original message has only HTML content (no plain text body)
- Removed unused formatQuotedMessageHTML function

Fixes edge cases where --quote would skip messages with HTML-only bodies.
@steipete steipete merged commit 8acdc43 into openclaw:main Feb 14, 2026
1 check passed
@steipete
Copy link
Copy Markdown
Collaborator

Landed via maintainer follow-up.

  • Gate: make ci
  • PR head fix commit: 4885e2f
  • Squash merge commit: 8acdc43
  • Changelog follow-up on main: 951437d

Thanks @terry-li-hm!

klodr pushed a commit to klodr/gogcli that referenced this pull request Apr 22, 2026
…aw#169)

* feat: add --quote flag to include original message in replies

Adds a --quote flag to gog gmail send that automatically quotes the original message when replying.

Changes:
- Added --quote flag to GmailSendCmd struct
- Modified fetchReplyInfo to optionally fetch message body
- Added formatQuotedMessage function for attribution and quoting
- Updated validation to require reply target when --quote is used

* feat(gmail): add --quote flag to gmail send command

Add automatic message quoting when replying to emails. The new --quote flag
includes the original message body with proper attribution line and quote
prefixes when using --reply-to-message-id or --thread-id.

Changes:
- Add Quote bool flag to GmailSendCmd struct
- Validate --quote requires reply target (--reply-to-message-id or --thread-id)
- Modify fetchReplyInfo to support fetching full message format for quoting
- Add Date and Body fields to replyInfo struct
- Add formatQuotedMessage function to format original message as quote
- Append quoted message to user's body when --quote is set
- Update test calls to replyInfoFromMessage with new includeBody parameter
- Use gmailFormatFull/gmailFormatMetadata constants instead of string literals
- Use body += for appending instead of body = body +

* feat(gmail): add HTML blockquote support for --quote feature

* fix(gmail): include user body in HTML when using --quote

* feat(gmail): preserve original HTML formatting when quoting

* fix(gmail): handle --body-file and --body-html edge cases with --quote

* fix(gmail): handle HTML-only messages when using --quote

- Quote now works when original message has only HTML content (no plain text body)
- Removed unused formatQuotedMessageHTML function

Fixes edge cases where --quote would skip messages with HTML-only bodies.

* fix(gmail): harden --quote body selection + watch includeBody format (openclaw#169) (thanks @terry-li-hm)

---------

Co-authored-by: OpenCode <opencode@local>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
klodr pushed a commit to klodr/gogcli that referenced this pull request Apr 22, 2026
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.

2 participants