fix(gmail): rename +read --format to --body-format to avoid global flag collision#751
Conversation
🦋 Changeset detectedLatest commit: 09395aa The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a CLI argument collision where a local subcommand flag was conflicting with a global flag, leading to incorrect default value propagation and unnecessary warnings. By renaming the local argument, the CLI behavior is now unambiguous. The change also includes minor code maintenance to simplify match logic. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request resolves a flag collision by renaming the local --format argument to --body-format within the gmail +read command. It also includes a minor refactor in script.rs to use match guards for better readability. A review comment correctly identified that the updated documentation example used an incorrect field name for jq filtering, which would result in null output for users.
…ag collision The +read subcommand defined a local --format arg (default: "text") that shared its name with the global --format flag (declared .global(true)). clap propagated the "text" default up to the root matches, causing main.rs to emit a spurious "unknown output format 'text'" warning on every +read invocation. Rename the arg to --body-format to eliminate the collision. The global --format flag is now unambiguous for +read; --body-format text (default) renders plain text and --body-format json returns the structured JSON object as before. Also collapse pre-existing clippy::collapsible_match in helpers/script.rs.
f26c7b8 to
09395aa
Compare
|
Fixed — the example now uses |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request resolves a naming collision between the local --format argument in the gmail +read command and the global --format flag by renaming the local argument to --body-format. The changes include updates to the CLI argument definition, help documentation, and the internal handler. Additionally, a minor refactor was performed in script.rs to use match guards for JSON file processing. I have no feedback to provide.
Problem
Closes #740 (partial — format-collision sub-issue)
gmail +readdefined a local--formatarg withdefault_value("text")andvalue_parser(["text", "json"]). The root--formatflag is declared.global(true), so clap propagated the"text"default up to the rootArgMatches.main.rsreads the global--formatvalue, gets"text",doesn't recognise it as a valid output format (valid:
json,table,yaml,csv), and emits a spurious warning on every+readinvocation:Fix
Rename the
+readlocal arg from--formatto--body-format. The namecollision is eliminated; the global
--formatflag is now unambiguous when+readis the active subcommand.Behaviour is otherwise unchanged:
--body-format text--body-format jsonThe
after_helpexample is updated from--format jsonto--body-format json.Migration note
Scripts or aliases using
gws gmail +read --format jsonmust be updated togws gmail +read --body-format json.Testing
cargo clippy -- -D warnings: cleancargo test: 699 pass, 2 fail (pre-existingtest_get_quota_project_*ADCenvironment tests unrelated to this change — confirmed failing on unmodified
upstream/maintoo)Also collapses a pre-existing
clippy::collapsible_matchinhelpers/script.rsthat surfaces on every fresh branch from
upstream/main(same fix as PRs #744,#747, #748, #749, #750).
🤖 Generated with Claude Code