Skip to content

feat(gmail): add forward command with tests and helpers#167

Closed
salmonumbrella wants to merge 23 commits intosteipete:mainfrom
salmonumbrella:feat/gmail-forward
Closed

feat(gmail): add forward command with tests and helpers#167
salmonumbrella wants to merge 23 commits intosteipete:mainfrom
salmonumbrella:feat/gmail-forward

Conversation

@salmonumbrella
Copy link
Copy Markdown
Contributor

@salmonumbrella salmonumbrella commented Feb 2, 2026

Closes #166

Summary

  • Add gmail forward command to forward emails to specified recipients
  • Extract shared resolveSendFrom() helper to reduce code duplication between send/forward
  • Add comprehensive test coverage for forward edge cases (HTML-only, custom subject, CC/BCC)
  • Fix lint issues (shadow declaration, slice preallocation, goconst)

Test plan

  • All existing tests pass (go test ./...)
  • golangci-lint passes with 0 issues
  • New forward tests cover: default subject, attachments, HTML-only messages, custom subject override, CC/BCC recipients

🤖 Generated with Claude Code

salmonumbrella and others added 23 commits January 30, 2026 19:15
- Fix variable shadowing in DocsUpdateCmd (govet: shadow)
- Extract formatAuto constant to satisfy goconst linter

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Cover the readTextInput function and file path expansion logic
by testing DocsWriteCmd and DocsUpdateCmd with temp files.
Also test error cases: non-existent file, empty file, and
mutual exclusion of --text and --file flags.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Test that --index flag properly rejects zero and negative values
with the expected error message.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Distinguish the update command from write by specifying it inserts
text at a specific index position in the document.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add integration tests verifying isDayExpr() integration:
- TestResolveTimeRangeWithDefaultsToTomorrowEndOfDay: verifies
  --to tomorrow expands to end-of-day (23:59:59.999999999)
- TestResolveTimeRangeWithDefaultsToNowNoExpansion: verifies
  --to now does NOT expand to end-of-day (remains current time)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add boolTrue/boolFalse constants for string "true"/"false" values
- Rename shadowed err variable to writeErr in test file

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rename err to convertErr to avoid shadowing the err variable
declared earlier in the function.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix shadow declaration lint error in forward test
- Add edge case tests: HTML-only, custom subject, CC/BCC
- Extract shared resolveSendFrom() helper to gmail_helpers.go
- Remove redundant subject empty check (dead code)
- Fix slice preallocation lint warnings
- Add defaultAttachmentFilename constant to fix goconst lint

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dahifi
Copy link
Copy Markdown

dahifi commented Mar 19, 2026

Bumping this — we're actively using gogcli for AFGE union operations (email triage, member outreach, grievance management) and the forward command would be a big quality-of-life improvement for our workflow. Happy to help test if there's anything needed to move this along.

@steipete
Copy link
Copy Markdown
Owner

Thanks for the contribution. I reviewed this against current main; gog gmail forward has since landed via #482 with attachment forwarding, no-send guards, docs, and regression/live smoke coverage.

Closing this older forward implementation as obsolete to avoid carrying a large conflicting duplicate. Focused follow-ups against the landed command are welcome.

@steipete steipete closed this Apr 20, 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.

Feature request: Add email forwarding support

3 participants