Add --mailbox flag to mail read command#2
Merged
Conversation
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.
902d9e7 to
6fb16ca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
-m, --mailboxsupport tomail readso users can read messages (and list attachments) from non-default folders without changing global config.When omitted,
mail readstill falls back todefaults.mailbox, so existing behavior remains unchanged.Changes
internal/cli/cli.goMailboxflag toMailReadCmd(-m,--mailbox)internal/cli/mail.go--mailboxwhen providedconfig.defaults.mailboxGetMessage(...)GetAttachments(...)internal/cli/help.gomail readcommand schema to include--mailbox--attachmentsand--htmlentries formail readpm-cli mail read 123 -m Archive)Docs
docs/commands.md: add--mailboxtomail readflags and examplesREADME.md: add mailbox-specificmail readexampleTests
internal/cli/cli_test.go: extendTestMailReadCmdOptionsto coverMailboxWhy
Users often move mail into folders (Archive/custom folders). Before this change,
mail readalways targeted the configured default mailbox, making it awkward to read moved messages unless the default mailbox was changed.Usage
Validation
go test ./...