feat(gmail): export filters as WebUI XML#553
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b425d6ab73
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| data, err = json.MarshalIndent(payload, "", " ") | ||
| if err != nil { | ||
| return err | ||
| } | ||
| data = append(data, '\n') |
There was a problem hiding this comment.
Preserve JSON transforms for file exports
When --format json --out ... is used, this branch marshals with json.MarshalIndent instead of outfmt.WriteJSON, so JSON-mode transforms (--results-only / --select) are no longer applied to the exported file. Before this commit, gog gmail filters export --out ... always wrote through outfmt.WriteJSON, so scripts relying on projected/unwrapped output now get a different file payload even though the same global JSON flags are set.
Useful? React with 👍 / 👎.
Summary
gog gmail filters exportemit Gmail WebUI-importable Atom XML by default--format jsonand global--jsonstdout compatibilityCloses #174.
Testing
go test -vet=off ./internal/cmd -run TestGmailFiltersmake buildmake docs-commandsmake docs-siteclawdbot@gmail.comsmoke: created disposable label/filter, exportedmailFilters.xml, parsed XML forhasTheWord,label, andshouldArchive, then deleted the filter and label./bin/gog --account clawdbot@gmail.com gmail filters export --format json --no-input | jq 'has("filters")'\n-make ci