@@ -7,9 +7,7 @@ use dialoguer::{Confirm, FuzzySelect, Select};
77use super :: args:: EmailArgs ;
88use crate :: client:: TrpcClient ;
99use crate :: template;
10- use crate :: types:: {
11- SendEmailResponse , SponsorEmailTemplate , TemplateListResponse ,
12- } ;
10+ use crate :: types:: { SendEmailResponse , SponsorEmailTemplate , TemplateListResponse } ;
1311use crate :: ui;
1412
1513pub async fn run ( args : EmailArgs ) -> Result < ( ) > {
@@ -19,10 +17,7 @@ pub async fn run(args: EmailArgs) -> Result<()> {
1917 let template_resp = fetch_templates ( & client, & args. id ) . await ?;
2018 sp. finish_and_clear ( ) ;
2119
22- let sponsor_name = template_resp
23- . sponsor_name
24- . as_deref ( )
25- . unwrap_or ( "Unknown" ) ;
20+ let sponsor_name = template_resp. sponsor_name . as_deref ( ) . unwrap_or ( "Unknown" ) ;
2621
2722 let is_interactive = console:: Term :: stdout ( ) . is_term ( ) && args. message . is_none ( ) ;
2823
@@ -36,10 +31,9 @@ pub async fn run(args: EmailArgs) -> Result<()> {
3631 } else if is_interactive {
3732 pick_template_interactive ( & args, & template_resp, sponsor_name) ?
3833 } else {
39- let slug = args
40- . template
41- . as_deref ( )
42- . ok_or_else ( || anyhow:: anyhow!( "--template or --message required in non-interactive mode" ) ) ?;
34+ let slug = args. template . as_deref ( ) . ok_or_else ( || {
35+ anyhow:: anyhow!( "--template or --message required in non-interactive mode" )
36+ } ) ?;
4337 pick_template_by_slug ( & args, & template_resp, slug) ?
4438 } ;
4539
@@ -84,7 +78,15 @@ pub async fn run(args: EmailArgs) -> Result<()> {
8478 }
8579 }
8680
87- send_email ( & client, & args, & args. id , & subject, & body, & recipients_display) . await
81+ send_email (
82+ & client,
83+ & args,
84+ & args. id ,
85+ & subject,
86+ & body,
87+ & recipients_display,
88+ )
89+ . await
8890}
8991
9092fn pick_template_interactive (
@@ -96,11 +98,7 @@ fn pick_template_interactive(
9698 bail ! ( "No email templates found. Create templates in the web UI first." ) ;
9799 }
98100
99- let items: Vec < String > = resp
100- . templates
101- . iter ( )
102- . map ( format_template_item)
103- . collect ( ) ;
101+ let items: Vec < String > = resp. templates . iter ( ) . map ( format_template_item) . collect ( ) ;
104102
105103 let default_idx = if let Some ( ref slug) = args. template {
106104 resp. templates
@@ -167,7 +165,11 @@ fn format_template_item(t: &SponsorEmailTemplate) -> String {
167165 crate :: types:: TemplateLanguage :: English => "🇬🇧" ,
168166 crate :: types:: TemplateLanguage :: Unknown => " " ,
169167 } ;
170- let default_marker = if t. is_default == Some ( true ) { " ★" } else { "" } ;
168+ let default_marker = if t. is_default == Some ( true ) {
169+ " ★"
170+ } else {
171+ ""
172+ } ;
171173 format ! (
172174 "{} {:<30} {:<16}{}" ,
173175 lang,
@@ -310,9 +312,7 @@ async fn send_email(
310312 "body" : body,
311313 } ) ;
312314
313- let result: SendEmailResponse = client
314- . mutate ( "sponsor.crm.sendEmailBySfc" , & input)
315- . await ?;
315+ let result: SendEmailResponse = client. mutate ( "sponsor.crm.sendEmailBySfc" , & input) . await ?;
316316 sp. finish_and_clear ( ) ;
317317
318318 if args. json {
0 commit comments