@@ -91,46 +91,43 @@ fn main() {
9191 WorkspaceCommands :: List { format } => workspace:: list ( & format) ,
9292 _ => eprintln ! ( "not yet implemented" ) ,
9393 } ,
94- Commands :: Connections { command } => match command {
95- ConnectionsCommands :: New { workspace_id } => {
96- let workspace_id = resolve_workspace ( workspace_id) ;
97- connections_new:: run ( & workspace_id)
98- }
99- ConnectionsCommands :: Create { command, workspace_id, name, source_type, config, format } => {
100- match command {
101- Some ( ConnectionsCreateCommands :: List { name, workspace_id, format } ) => {
102- let workspace_id = resolve_workspace ( workspace_id) ;
103- match name. as_deref ( ) {
104- Some ( name) => connections:: types_get ( & workspace_id, name, & format) ,
105- None => connections:: types_list ( & workspace_id, & format) ,
94+ Commands :: Connections { workspace_id, command } => {
95+ let workspace_id = resolve_workspace ( workspace_id) ;
96+ match command {
97+ ConnectionsCommands :: New => connections_new:: run ( & workspace_id) ,
98+ ConnectionsCommands :: List { format } => {
99+ connections:: list ( & workspace_id, & format)
100+ }
101+ ConnectionsCommands :: Create { command, name, source_type, config, format } => {
102+ match command {
103+ Some ( ConnectionsCreateCommands :: List { name, format } ) => {
104+ match name. as_deref ( ) {
105+ Some ( name) => connections:: types_get ( & workspace_id, name, & format) ,
106+ None => connections:: types_list ( & workspace_id, & format) ,
107+ }
106108 }
107- }
108- None => {
109- let missing: Vec < & str > = [
110- name. is_none ( ) . then_some ( "--name" ) ,
111- source_type. is_none ( ) . then_some ( "--type" ) ,
112- config. is_none ( ) . then_some ( "--config" ) ,
113- ] . into_iter ( ) . flatten ( ) . collect ( ) ;
114- if !missing. is_empty ( ) {
115- eprintln ! ( "error: missing required arguments: {}" , missing. join( ", " ) ) ;
116- std:: process:: exit ( 1 ) ;
109+ None => {
110+ let missing: Vec < & str > = [
111+ name. is_none ( ) . then_some ( "--name" ) ,
112+ source_type. is_none ( ) . then_some ( "--type" ) ,
113+ config. is_none ( ) . then_some ( "--config" ) ,
114+ ] . into_iter ( ) . flatten ( ) . collect ( ) ;
115+ if !missing. is_empty ( ) {
116+ eprintln ! ( "error: missing required arguments: {}" , missing. join( ", " ) ) ;
117+ std:: process:: exit ( 1 ) ;
118+ }
119+ connections:: create (
120+ & workspace_id,
121+ & name. unwrap ( ) ,
122+ & source_type. unwrap ( ) ,
123+ & config. unwrap ( ) ,
124+ & format,
125+ )
117126 }
118- let workspace_id = resolve_workspace ( workspace_id) ;
119- connections:: create (
120- & workspace_id,
121- & name. unwrap ( ) ,
122- & source_type. unwrap ( ) ,
123- & config. unwrap ( ) ,
124- & format,
125- )
126127 }
127128 }
128- } ,
129- ConnectionsCommands :: List { workspace_id, format } => {
130- let workspace_id = resolve_workspace ( workspace_id) ;
131- connections:: list ( & workspace_id, & format)
129+ _ => eprintln ! ( "not yet implemented" ) ,
132130 }
133- _ => eprintln ! ( "not yet implemented" ) ,
134131 } ,
135132 Commands :: Tables { command } => match command {
136133 TablesCommands :: List { workspace_id, connection_id, schema, table, limit, cursor, format } => {
0 commit comments