Skip to content

Add --mailbox flag to mail read command#2

Merged
bscott merged 1 commit into
bscott:masterfrom
jesseposner:feat/mail-read-mailbox
Feb 22, 2026
Merged

Add --mailbox flag to mail read command#2
bscott merged 1 commit into
bscott:masterfrom
jesseposner:feat/mail-read-mailbox

Conversation

@jesseposner
Copy link
Copy Markdown
Contributor

@jesseposner jesseposner commented Feb 17, 2026

Summary

Add -m, --mailbox support to mail read so users can read messages (and list attachments) from non-default folders without changing global config.

When omitted, mail read still falls back to defaults.mailbox, so existing behavior remains unchanged.

Changes

  • internal/cli/cli.go

    • Add Mailbox flag to MailReadCmd (-m, --mailbox)
  • internal/cli/mail.go

    • Resolve effective mailbox as:
      • --mailbox when provided
      • otherwise config.defaults.mailbox
    • Apply effective mailbox to both:
      • GetMessage(...)
      • GetAttachments(...)
  • internal/cli/help.go

    • Update mail read command schema to include --mailbox
    • Add missing --attachments and --html entries for mail read
    • Add mailbox example (pm-cli mail read 123 -m Archive)
  • Docs

    • docs/commands.md: add --mailbox to mail read flags and examples
    • README.md: add mailbox-specific mail read example
  • Tests

    • internal/cli/cli_test.go: extend TestMailReadCmdOptions to cover Mailbox

Why

Users often move mail into folders (Archive/custom folders). Before this change, mail read always targeted the configured default mailbox, making it awkward to read moved messages unless the default mailbox was changed.

Usage

pm-cli mail read 42 -m "Folders/Investors"
pm-cli mail read 1 --mailbox Archive --json
pm-cli mail read 10 -m "Folders/Signups" --attachments

Validation

  • go test ./...

Add -m/--mailbox to mail read so reads and attachment listing can target non-default folders. When omitted, mail read continues to use defaults.mailbox.

Also update command schema/help metadata and docs examples, and add coverage in cli options tests.
@jesseposner jesseposner force-pushed the feat/mail-read-mailbox branch from 902d9e7 to 6fb16ca Compare February 17, 2026 20:33
@bscott bscott merged commit 367e1e2 into bscott:master Feb 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