feat(mail): add --all flag to 'gt mail inbox' command

Adds --all/-a flag as a semantic complement to --unread. While the
default behavior already shows all messages, --all makes the intent
explicit when viewing the complete inbox.

The flags are mutually exclusive - using both --all and --unread
returns an error.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
dementus
2026-01-20 20:37:19 -08:00
committed by beads/crew/emma
parent cd347dfdf9
commit d610d444d7
2 changed files with 14 additions and 0 deletions

View File

@@ -30,6 +30,11 @@ func getMailbox(address string) (*mail.Mailbox, error) {
}
func runMailInbox(cmd *cobra.Command, args []string) error {
// Check for mutually exclusive flags
if mailInboxAll && mailInboxUnread {
return errors.New("--all and --unread are mutually exclusive")
}
// Determine which inbox to check (priority: --identity flag, positional arg, auto-detect)
address := ""
if mailInboxIdentity != "" {
@@ -46,6 +51,8 @@ func runMailInbox(cmd *cobra.Command, args []string) error {
}
// Get messages
// --all is the default behavior (shows all messages)
// --unread filters to only unread messages
var messages []*mail.Message
if mailInboxUnread {
messages, err = mailbox.ListUnread()