diff --git a/.changeset/fix-gmail-draft-send-tip.md b/.changeset/fix-gmail-draft-send-tip.md new file mode 100644 index 000000000..53bedfc52 --- /dev/null +++ b/.changeset/fix-gmail-draft-send-tip.md @@ -0,0 +1,5 @@ +--- +"@googleworkspace/cli": patch +--- + +Correct the Gmail draft send command shown by the `--draft` helper. diff --git a/crates/google-workspace-cli/src/helpers/gmail/mod.rs b/crates/google-workspace-cli/src/helpers/gmail/mod.rs index caeb8b6b0..8610b4f91 100644 --- a/crates/google-workspace-cli/src/helpers/gmail/mod.rs +++ b/crates/google-workspace-cli/src/helpers/gmail/mod.rs @@ -1431,6 +1431,10 @@ fn build_send_metadata(thread_id: Option<&str>, draft: bool) -> Option { } } +fn draft_send_tip() -> &'static str { + "gws gmail users drafts send --params '{\"userId\":\"me\"}' --json '{\"id\":\"\"}'" +} + pub(super) async fn dispatch_raw_email( doc: &crate::discovery::RestDescription, matches: &ArgMatches, @@ -1488,7 +1492,7 @@ pub(super) async fn dispatch_raw_email( if draft && !matches.get_flag("dry-run") { eprintln!("Tip: copy the draft \"id\" from the response above, then send with:"); - eprintln!(" gws gmail users.drafts.send --body '{{\"id\":\"\"}}'"); + eprintln!(" {}", draft_send_tip()); } Ok(()) @@ -2360,6 +2364,14 @@ mod tests { assert!(parsed["message"].get("threadId").is_none()); } + #[test] + fn test_draft_send_tip_uses_valid_discovery_command_syntax() { + assert_eq!( + draft_send_tip(), + "gws gmail users drafts send --params '{\"userId\":\"me\"}' --json '{\"id\":\"\"}'" + ); + } + #[test] fn test_append_address_list_header_value() { let mut header_value = String::new();