From 09395aa4a45cdab142aebc15988e64c3bdf8f83f Mon Sep 17 00:00:00 2001 From: Hoyt Harness <2735828+hoyt-harness@users.noreply.github.com> Date: Wed, 22 Apr 2026 12:52:48 -0500 Subject: [PATCH] fix(gmail): rename +read --format to --body-format to avoid global flag 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. --- .changeset/fix-read-format-collision.md | 19 +++++++++++++++++++ .../src/helpers/gmail/mod.rs | 8 ++++---- .../src/helpers/gmail/read.rs | 2 +- .../src/helpers/script.rs | 9 ++------- 4 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 .changeset/fix-read-format-collision.md diff --git a/.changeset/fix-read-format-collision.md b/.changeset/fix-read-format-collision.md new file mode 100644 index 00000000..8f381d11 --- /dev/null +++ b/.changeset/fix-read-format-collision.md @@ -0,0 +1,19 @@ +--- +"@googleworkspace/cli": patch +--- + +Fix `+read` local `--format` arg colliding with the global `--format` flag. + +Previously, `gmail +read` defined a local `--format` arg (values: `text`, `json`, +default: `text`). Because the global `--format` flag is declared with +`.global(true)`, clap propagated the `text` default up to the parent matches, +causing `main.rs` to emit a spurious `"unknown output format 'text'; falling back +to json"` warning on every `+read` invocation. + +The local arg is renamed to `--body-format` to eliminate the name collision. +`--body-format text` (default) renders the decoded message body as plain text; +`--body-format json` returns the full structured JSON object, matching the previous +`--format json` behaviour. + +**Migration note:** Scripts or aliases using `gws gmail +read --format json` must +be updated to `gws gmail +read --body-format json`. diff --git a/crates/google-workspace-cli/src/helpers/gmail/mod.rs b/crates/google-workspace-cli/src/helpers/gmail/mod.rs index caeb8b6b..da6e5625 100644 --- a/crates/google-workspace-cli/src/helpers/gmail/mod.rs +++ b/crates/google-workspace-cli/src/helpers/gmail/mod.rs @@ -1808,9 +1808,9 @@ Use fragment tags (