@@ -289,7 +289,7 @@ impl Shuttle {
289289 } => self . delete_certificate ( domain, yes) . await ,
290290 } ,
291291 Command :: Project ( cmd) => match cmd {
292- ProjectCommand :: Create => self . project_create ( args. project_args . name ) . await ,
292+ ProjectCommand :: Create => self . project_create ( & args. project_args ) . await ,
293293 ProjectCommand :: Update ( cmd) => match cmd {
294294 ProjectUpdateCommand :: Name { new_name } => self . project_rename ( new_name) . await ,
295295 } ,
@@ -1798,24 +1798,31 @@ impl Shuttle {
17981798 Ok ( ( ) )
17991799 }
18001800
1801- async fn project_create ( & self , name : Option < String > ) -> Result < ( ) > {
1802- let Some ( ref name) = name else {
1801+ async fn project_create ( & mut self , project_args : & ProjectArgs ) -> Result < ( ) > {
1802+ let Some ( ref name) = project_args . name else {
18031803 bail ! ( "Provide a project name with '--name <name>'" ) ;
18041804 } ;
18051805
1806+ self . ctx . load_local_internal_config ( project_args) ?;
1807+
18061808 let client = self . client . as_ref ( ) . unwrap ( ) ;
18071809 let r = client. create_project ( name) . await ?;
18081810
1811+ let raw_json = r. raw_json . clone ( ) ;
1812+ let project = r. into_inner ( ) ;
1813+
18091814 match self . output_mode {
18101815 OutputMode :: Normal => {
1811- let project = r. into_inner ( ) ;
18121816 println ! ( "Created project '{}' with id {}" , project. name, project. id) ;
18131817 }
18141818 OutputMode :: Json => {
1815- println ! ( "{}" , r . raw_json) ;
1819+ println ! ( "{}" , raw_json) ;
18161820 }
18171821 }
18181822
1823+ self . ctx . set_project_id ( project. id ) ;
1824+ self . ctx . save_local_internal ( ) ?;
1825+
18191826 Ok ( ( ) )
18201827 }
18211828
0 commit comments