@@ -102,7 +102,7 @@ async fn resolve_user_id(client: &LinearClient, user: &str) -> Result<String> {
102102 for u in users {
103103 let name = u[ "name" ] . as_str ( ) . unwrap_or ( "" ) ;
104104 let email = u[ "email" ] . as_str ( ) . unwrap_or ( "" ) ;
105-
105+
106106 if name. eq_ignore_ascii_case ( user) || email. eq_ignore_ascii_case ( user) {
107107 if let Some ( id) = u[ "id" ] . as_str ( ) {
108108 return Ok ( id. to_string ( ) ) ;
@@ -134,7 +134,9 @@ async fn resolve_state_id(client: &LinearClient, team_id: &str, state: &str) ->
134134 }
135135 "# ;
136136
137- let result = client. query ( query, Some ( json ! ( { "teamId" : team_id } ) ) ) . await ?;
137+ let result = client
138+ . query ( query, Some ( json ! ( { "teamId" : team_id } ) ) )
139+ . await ?;
138140 let empty = vec ! [ ] ;
139141 let states = result[ "data" ] [ "team" ] [ "states" ] [ "nodes" ]
140142 . as_array ( )
@@ -192,7 +194,10 @@ async fn resolve_label_id(client: &LinearClient, label: &str) -> Result<String>
192194}
193195
194196/// Get issue details including UUID and team ID from identifier (e.g., "LIN-123")
195- async fn get_issue_info ( client : & LinearClient , issue_id : & str ) -> Result < ( String , String , Option < String > ) > {
197+ async fn get_issue_info (
198+ client : & LinearClient ,
199+ issue_id : & str ,
200+ ) -> Result < ( String , String , Option < String > ) > {
196201 let query = r#"
197202 query($id: String!) {
198203 issue(id: $id) {
@@ -222,27 +227,17 @@ async fn get_issue_info(client: &LinearClient, issue_id: &str) -> Result<(String
222227 . ok_or_else ( || anyhow:: anyhow!( "Failed to get team ID" ) ) ?
223228 . to_string ( ) ;
224229
225- let identifier = issue[ "identifier" ]
226- . as_str ( )
227- . map ( |s| s. to_string ( ) ) ;
230+ let identifier = issue[ "identifier" ] . as_str ( ) . map ( |s| s. to_string ( ) ) ;
228231
229232 Ok ( ( uuid, team_id, identifier) )
230233}
231234
232235pub async fn handle ( cmd : BulkCommands ) -> Result < ( ) > {
233236 match cmd {
234- BulkCommands :: UpdateState { state, issues } => {
235- bulk_update_state ( & state, issues) . await
236- }
237- BulkCommands :: Assign { user, issues } => {
238- bulk_assign ( & user, issues) . await
239- }
240- BulkCommands :: Label { label, issues } => {
241- bulk_label ( & label, issues) . await
242- }
243- BulkCommands :: Unassign { issues } => {
244- bulk_unassign ( issues) . await
245- }
237+ BulkCommands :: UpdateState { state, issues } => bulk_update_state ( & state, issues) . await ,
238+ BulkCommands :: Assign { user, issues } => bulk_assign ( & user, issues) . await ,
239+ BulkCommands :: Label { label, issues } => bulk_label ( & label, issues) . await ,
240+ BulkCommands :: Unassign { issues } => bulk_unassign ( issues) . await ,
246241 }
247242}
248243
@@ -268,9 +263,7 @@ async fn bulk_update_state(state: &str, issues: Vec<String>) -> Result<()> {
268263 let client = & client;
269264 let state = & state_owned;
270265 let id = issue_id. clone ( ) ;
271- async move {
272- update_issue_state ( client, & id, state) . await
273- }
266+ async move { update_issue_state ( client, & id, state) . await }
274267 } )
275268 . collect ( ) ;
276269
@@ -310,9 +303,7 @@ async fn bulk_assign(user: &str, issues: Vec<String>) -> Result<()> {
310303 let client = & client;
311304 let user_id = & user_id;
312305 let id = issue_id. clone ( ) ;
313- async move {
314- update_issue_assignee ( client, & id, Some ( user_id) ) . await
315- }
306+ async move { update_issue_assignee ( client, & id, Some ( user_id) ) . await }
316307 } )
317308 . collect ( ) ;
318309
@@ -352,9 +343,7 @@ async fn bulk_label(label: &str, issues: Vec<String>) -> Result<()> {
352343 let client = & client;
353344 let label_id = & label_id;
354345 let id = issue_id. clone ( ) ;
355- async move {
356- add_label_to_issue ( client, & id, label_id) . await
357- }
346+ async move { add_label_to_issue ( client, & id, label_id) . await }
358347 } )
359348 . collect ( ) ;
360349
@@ -370,11 +359,7 @@ async fn bulk_unassign(issues: Vec<String>) -> Result<()> {
370359 return Ok ( ( ) ) ;
371360 }
372361
373- println ! (
374- "{} Unassigning {} issues..." ,
375- ">>" . cyan( ) ,
376- issues. len( )
377- ) ;
362+ println ! ( "{} Unassigning {} issues..." , ">>" . cyan( ) , issues. len( ) ) ;
378363
379364 let client = LinearClient :: new ( ) ?;
380365
@@ -383,9 +368,7 @@ async fn bulk_unassign(issues: Vec<String>) -> Result<()> {
383368 . map ( |issue_id| {
384369 let client = & client;
385370 let id = issue_id. clone ( ) ;
386- async move {
387- update_issue_assignee ( client, & id, None ) . await
388- }
371+ async move { update_issue_assignee ( client, & id, None ) . await }
389372 } )
390373 . collect ( ) ;
391374
@@ -554,44 +537,45 @@ async fn add_label_to_issue(client: &LinearClient, issue_id: &str, label_id: &st
554537 }
555538 "# ;
556539
557- let ( uuid, identifier, existing_label_ids) = match client. query ( query, Some ( json ! ( { "id" : issue_id } ) ) ) . await {
558- Ok ( result) => {
559- if result[ "data" ] [ "issue" ] . is_null ( ) {
540+ let ( uuid, identifier, existing_label_ids) =
541+ match client. query ( query, Some ( json ! ( { "id" : issue_id } ) ) ) . await {
542+ Ok ( result) => {
543+ if result[ "data" ] [ "issue" ] . is_null ( ) {
544+ return BulkResult {
545+ issue_id : issue_id. to_string ( ) ,
546+ success : false ,
547+ identifier : None ,
548+ error : Some ( "Issue not found" . to_string ( ) ) ,
549+ } ;
550+ }
551+
552+ let uuid = result[ "data" ] [ "issue" ] [ "id" ]
553+ . as_str ( )
554+ . unwrap_or ( issue_id)
555+ . to_string ( ) ;
556+
557+ let identifier = result[ "data" ] [ "issue" ] [ "identifier" ]
558+ . as_str ( )
559+ . map ( |s| s. to_string ( ) ) ;
560+
561+ let labels: Vec < String > = result[ "data" ] [ "issue" ] [ "labels" ] [ "nodes" ]
562+ . as_array ( )
563+ . unwrap_or ( & vec ! [ ] )
564+ . iter ( )
565+ . filter_map ( |l| l[ "id" ] . as_str ( ) . map ( |s| s. to_string ( ) ) )
566+ . collect ( ) ;
567+
568+ ( uuid, identifier, labels)
569+ }
570+ Err ( e) => {
560571 return BulkResult {
561572 issue_id : issue_id. to_string ( ) ,
562573 success : false ,
563574 identifier : None ,
564- error : Some ( "Issue not found" . to_string ( ) ) ,
575+ error : Some ( e . to_string ( ) ) ,
565576 } ;
566577 }
567-
568- let uuid = result[ "data" ] [ "issue" ] [ "id" ]
569- . as_str ( )
570- . unwrap_or ( issue_id)
571- . to_string ( ) ;
572-
573- let identifier = result[ "data" ] [ "issue" ] [ "identifier" ]
574- . as_str ( )
575- . map ( |s| s. to_string ( ) ) ;
576-
577- let labels: Vec < String > = result[ "data" ] [ "issue" ] [ "labels" ] [ "nodes" ]
578- . as_array ( )
579- . unwrap_or ( & vec ! [ ] )
580- . iter ( )
581- . filter_map ( |l| l[ "id" ] . as_str ( ) . map ( |s| s. to_string ( ) ) )
582- . collect ( ) ;
583-
584- ( uuid, identifier, labels)
585- }
586- Err ( e) => {
587- return BulkResult {
588- issue_id : issue_id. to_string ( ) ,
589- success : false ,
590- identifier : None ,
591- error : Some ( e. to_string ( ) ) ,
592- } ;
593- }
594- } ;
578+ } ;
595579
596580 let mut label_ids = existing_label_ids;
597581
0 commit comments