feat(gmail): show attachment info in get command output#83
Merged
steipete merged 5 commits intoopenclaw:mainfrom Jan 17, 2026
Merged
feat(gmail): show attachment info in get command output#83steipete merged 5 commits intoopenclaw:mainfrom
steipete merged 5 commits intoopenclaw:mainfrom
Conversation
Display attachment filename, size, MIME type, and attachment_id in both
plain text and JSON output for the 'gmail get' command with --format=full.
This makes it easier to identify and download attachments without needing
to manually parse the message payload structure.
Example plain text output:
attachments:
CV-Document.pdf (192123 bytes, application/pdf)
attachment_id ANGjdJ...
Example JSON output (new field):
"attachments": [
{"Filename": "CV-Document.pdf", "Size": 192123, ...}
]
Add two test cases: - TestGmailGetCmd_JSON_Full_WithAttachments: verifies attachments array is present in JSON output with correct filename, size, mime type, and ID - TestGmailGetCmd_Text_Full_WithAttachments: verifies plain text output includes attachment info section with all expected fields
Use camelCase field names (filename, size, mimeType, attachmentId) to be consistent with the rest of the JSON output (messageId, labelIds, etc.)
Use tab-separated format like other gog commands: attachment\t<filename>\t<size>\t<mimeType>\t<attachmentId> This matches the pattern used in calendar_print.go (attendee, attachment) and drive.go for array data.
34d8fc6 to
67eb0d9
Compare
Collaborator
|
Landed via temp rebase onto main. Thanks @jeanregisser! |
klodr
pushed a commit
to klodr/gogcli
that referenced
this pull request
Apr 22, 2026
klodr
pushed a commit
to klodr/gogcli
that referenced
this pull request
Apr 22, 2026
…ents-in-get feat(gmail): show attachment info in get command output
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
Display attachment filename, size, MIME type, and attachment_id in both plain text and JSON output for the
gmail getcommand with--format=full.This makes it easier to identify and download attachments without needing to manually parse the message payload structure.
Problem
When using
gog gmail get <messageId>, there's no indication of attachments in the output. Users need to use--format=full --jsonand then manually parse the nestedmessage.payload.partsstructure to find attachment IDs before they can usegog gmail attachmentto download them.Solution
Reuse the existing
collectAttachments()function fromgmail_thread.goto extract and display attachment info in both output formats.Example plain text output (new section before body):
Example JSON output (new field):
{ "attachments": [ {"filename": "CV-Document.pdf", "size": 192123, "mimeType": "application/pdf", "attachmentId": "ANGjdJ..."} ] }AI-Assisted Development
This PR was created with AI assistance. The prompts used:
Initial prompt:
Follow-up prompt:
Context: The user was trying to download an email attachment and struggled because
gog gmail getdidn't show attachment info. They had to:gog gmail get <id> --format=full --json.message.payload.parts[].body.attachmentIdgog gmail attachment <messageId> <attachmentId>With this change, the attachment ID is visible directly in the standard output.