@@ -3,8 +3,8 @@ mod settings;
33
44use anyhow:: { Context , Result } ;
55use clap:: { Parser , Subcommand } ;
6- use comfy_table:: { presets:: UTF8_BORDERS_ONLY , Cell , Color , Table } ;
76use client:: Client ;
7+ use comfy_table:: { Cell , Color , Table , presets:: UTF8_BORDERS_ONLY } ;
88use settings:: { CliOverrides , Settings } ;
99
1010#[ derive( Parser ) ]
@@ -192,10 +192,9 @@ async fn main() -> Result<()> {
192192 timeout : cli. timeout ,
193193 } ) ?;
194194
195- let workspace = settings
196- . workspace
197- . as_deref ( )
198- . context ( "workspace is required — set it via --workspace, PLANE_CLI_WORKSPACE, or config file" ) ?;
195+ let workspace = settings. workspace . as_deref ( ) . context (
196+ "workspace is required — set it via --workspace, PLANE_CLI_WORKSPACE, or config file" ,
197+ ) ?;
199198
200199 let client = Client :: new ( & settings, json_mode) ?;
201200
@@ -223,7 +222,8 @@ async fn main() -> Result<()> {
223222 table. set_header ( vec ! [ header( "Name" ) , header( "Identifier" ) , header( "ID" ) ] ) ;
224223 for project in results {
225224 table. add_row ( vec ! [
226- Cell :: new( project[ "name" ] . as_str( ) . unwrap_or( "(unnamed)" ) ) . fg( Color :: White ) ,
225+ Cell :: new( project[ "name" ] . as_str( ) . unwrap_or( "(unnamed)" ) )
226+ . fg( Color :: White ) ,
227227 Cell :: new( project[ "identifier" ] . as_str( ) . unwrap_or( "" ) ) ,
228228 Cell :: new( project[ "id" ] . as_str( ) . unwrap_or( "" ) ) . fg( Color :: DarkGrey ) ,
229229 ] ) ;
@@ -235,7 +235,9 @@ async fn main() -> Result<()> {
235235 Command :: States { action } => match action {
236236 StatesAction :: List { project } => {
237237 let data = client
238- . get ( & format ! ( "workspaces/{workspace}/projects/{project}/states/" ) )
238+ . get ( & format ! (
239+ "workspaces/{workspace}/projects/{project}/states/"
240+ ) )
239241 . await ?;
240242
241243 if json_mode {
@@ -255,7 +257,8 @@ async fn main() -> Result<()> {
255257 table. set_header ( vec ! [ header( "Name" ) , header( "Group" ) , header( "ID" ) ] ) ;
256258 for state in results {
257259 table. add_row ( vec ! [
258- Cell :: new( state[ "name" ] . as_str( ) . unwrap_or( "(unnamed)" ) ) . fg( Color :: White ) ,
260+ Cell :: new( state[ "name" ] . as_str( ) . unwrap_or( "(unnamed)" ) )
261+ . fg( Color :: White ) ,
259262 Cell :: new( state[ "group" ] . as_str( ) . unwrap_or( "" ) ) ,
260263 Cell :: new( state[ "id" ] . as_str( ) . unwrap_or( "" ) ) . fg( Color :: DarkGrey ) ,
261264 ] ) ;
@@ -267,7 +270,9 @@ async fn main() -> Result<()> {
267270 Command :: Labels { action } => match action {
268271 LabelsAction :: List { project } => {
269272 let data = client
270- . get ( & format ! ( "workspaces/{workspace}/projects/{project}/labels/" ) )
273+ . get ( & format ! (
274+ "workspaces/{workspace}/projects/{project}/labels/"
275+ ) )
271276 . await ?;
272277
273278 if json_mode {
@@ -287,7 +292,8 @@ async fn main() -> Result<()> {
287292 table. set_header ( vec ! [ header( "Name" ) , header( "ID" ) ] ) ;
288293 for label in results {
289294 table. add_row ( vec ! [
290- Cell :: new( label[ "name" ] . as_str( ) . unwrap_or( "(unnamed)" ) ) . fg( Color :: White ) ,
295+ Cell :: new( label[ "name" ] . as_str( ) . unwrap_or( "(unnamed)" ) )
296+ . fg( Color :: White ) ,
291297 Cell :: new( label[ "id" ] . as_str( ) . unwrap_or( "" ) ) . fg( Color :: DarkGrey ) ,
292298 ] ) ;
293299 }
@@ -298,19 +304,19 @@ async fn main() -> Result<()> {
298304 Command :: Members { action } => match action {
299305 MembersAction :: List { project } => {
300306 let data = client
301- . get ( & format ! ( "workspaces/{workspace}/projects/{project}/members/" ) )
307+ . get ( & format ! (
308+ "workspaces/{workspace}/projects/{project}/members/"
309+ ) )
302310 . await ?;
303311
304312 if json_mode {
305313 println ! ( "{}" , serde_json:: to_string_pretty( & data) ?) ;
306314 } else {
307315 let results = match data. as_array ( ) {
308316 Some ( arr) => arr,
309- None => {
310- data[ "results" ]
311- . as_array ( )
312- . context ( "unexpected response format" ) ?
313- }
317+ None => data[ "results" ]
318+ . as_array ( )
319+ . context ( "unexpected response format" ) ?,
314320 } ;
315321
316322 if results. is_empty ( ) {
@@ -323,7 +329,8 @@ async fn main() -> Result<()> {
323329 table. set_header ( vec ! [ header( "Name" ) , header( "ID" ) ] ) ;
324330 for member in results {
325331 table. add_row ( vec ! [
326- Cell :: new( member[ "display_name" ] . as_str( ) . unwrap_or( "(unnamed)" ) ) . fg( Color :: White ) ,
332+ Cell :: new( member[ "display_name" ] . as_str( ) . unwrap_or( "(unnamed)" ) )
333+ . fg( Color :: White ) ,
327334 Cell :: new( member[ "id" ] . as_str( ) . unwrap_or( "" ) ) . fg( Color :: DarkGrey ) ,
328335 ] ) ;
329336 }
@@ -372,7 +379,12 @@ async fn main() -> Result<()> {
372379
373380 let mut table = Table :: new ( ) ;
374381 table. load_preset ( UTF8_BORDERS_ONLY ) ;
375- table. set_header ( vec ! [ header( "#" ) , header( "Name" ) , header( "Priority" ) , header( "ID" ) ] ) ;
382+ table. set_header ( vec ! [
383+ header( "#" ) ,
384+ header( "Name" ) ,
385+ header( "Priority" ) ,
386+ header( "ID" ) ,
387+ ] ) ;
376388 for issue in results {
377389 let prio = issue[ "priority" ] . as_str ( ) . unwrap_or ( "none" ) ;
378390 table. add_row ( vec ! [
@@ -411,20 +423,14 @@ async fn main() -> Result<()> {
411423 println ! ( " {} {created}" , cyan. apply_to( "created: " ) ) ;
412424
413425 if let Some ( assignees) = data[ "assignees" ] . as_array ( ) {
414- let ids: Vec < & str > = assignees
415- . iter ( )
416- . filter_map ( |a| a. as_str ( ) )
417- . collect ( ) ;
426+ let ids: Vec < & str > = assignees. iter ( ) . filter_map ( |a| a. as_str ( ) ) . collect ( ) ;
418427 if !ids. is_empty ( ) {
419428 println ! ( " {} {}" , cyan. apply_to( "assignees:" ) , ids. join( ", " ) ) ;
420429 }
421430 }
422431
423432 if let Some ( labels) = data[ "labels" ] . as_array ( ) {
424- let ids: Vec < & str > = labels
425- . iter ( )
426- . filter_map ( |l| l. as_str ( ) )
427- . collect ( ) ;
433+ let ids: Vec < & str > = labels. iter ( ) . filter_map ( |l| l. as_str ( ) ) . collect ( ) ;
428434 if !ids. is_empty ( ) {
429435 println ! ( " {} {}" , cyan. apply_to( "labels: " ) , ids. join( ", " ) ) ;
430436 }
0 commit comments