@@ -475,19 +475,17 @@ pub fn list(workspace_id: &str, limit: Option<u32>, offset: Option<u32>, format:
475475 "json" => println ! ( "{}" , serde_json:: to_string_pretty( & body. datasets) . unwrap( ) ) ,
476476 "yaml" => print ! ( "{}" , serde_yaml:: to_string( & body. datasets) . unwrap( ) ) ,
477477 "table" => {
478- let mut table = crate :: util:: make_table ( ) ;
479- table. set_header ( [ "ID" , "LABEL" , "FULL NAME" , "CREATED AT" ] . map ( crate :: util:: hcell) ) ;
480- crate :: util:: no_wrap ( & mut table) ;
481478 if body. datasets . is_empty ( ) {
482479 use crossterm:: style:: Stylize ;
483480 eprintln ! ( "{}" , "No datasets found." . dark_grey( ) ) ;
484481 } else {
485- for d in & body. datasets {
486- let created_at = crate :: util:: format_date ( & d. created_at ) ;
487- let full_name = format ! ( "datasets.main.{}" , d. table_name) ;
488- table. add_row ( [ & d. id , & d. label , & full_name, & created_at] ) ;
489- }
490- crate :: util:: print_table ( & table) ;
482+ let rows: Vec < Vec < String > > = body. datasets . iter ( ) . map ( |d| vec ! [
483+ d. id. clone( ) ,
484+ d. label. clone( ) ,
485+ format!( "datasets.main.{}" , d. table_name) ,
486+ crate :: util:: format_date( & d. created_at) ,
487+ ] ) . collect ( ) ;
488+ crate :: table:: print ( & [ "ID" , "LABEL" , "FULL NAME" , "CREATED AT" ] , & rows) ;
491489 }
492490 if body. has_more {
493491 let next = offset. unwrap_or ( 0 ) + body. count as u32 ;
@@ -560,13 +558,10 @@ pub fn get(dataset_id: &str, workspace_id: &str, format: &str) {
560558 println ! ( "updated_at: {updated_at}" ) ;
561559 if !d. columns . is_empty ( ) {
562560 println ! ( ) ;
563- let mut table = crate :: util:: make_table ( ) ;
564- table. set_header ( [ "COLUMN" , "DATA TYPE" , "NULLABLE" ] . map ( crate :: util:: hcell) ) ;
565- crate :: util:: no_wrap ( & mut table) ;
566- for col in & d. columns {
567- table. add_row ( [ & col. name , & col. data_type , & col. nullable . to_string ( ) ] ) ;
568- }
569- crate :: util:: print_table ( & table) ;
561+ let rows: Vec < Vec < String > > = d. columns . iter ( ) . map ( |col| vec ! [
562+ col. name. clone( ) , col. data_type. clone( ) , col. nullable. to_string( ) ,
563+ ] ) . collect ( ) ;
564+ crate :: table:: print ( & [ "COLUMN" , "DATA TYPE" , "NULLABLE" ] , & rows) ;
570565 }
571566 }
572567 _ => unreachable ! ( ) ,
0 commit comments