@@ -300,7 +300,7 @@ impl Shuttle {
300300 } => self . delete_certificate ( domain, yes) . await ,
301301 } ,
302302 Command :: Project ( cmd) => match cmd {
303- ProjectCommand :: Create => self . project_create ( args. project_args . name ) . await ,
303+ ProjectCommand :: Create => self . project_create ( & args. project_args ) . await ,
304304 ProjectCommand :: Update ( cmd) => match cmd {
305305 ProjectUpdateCommand :: Name { new_name } => self . project_rename ( new_name) . await ,
306306 } ,
@@ -1929,24 +1929,31 @@ impl Shuttle {
19291929 Ok ( ( ) )
19301930 }
19311931
1932- async fn project_create ( & self , name : Option < String > ) -> Result < ( ) > {
1933- let Some ( ref name) = name else {
1932+ async fn project_create ( & mut self , project_args : & ProjectArgs ) -> Result < ( ) > {
1933+ let Some ( ref name) = project_args . name else {
19341934 bail ! ( "Provide a project name with '--name <name>'" ) ;
19351935 } ;
19361936
1937+ self . ctx . load_local_internal_config ( project_args) ?;
1938+
19371939 let client = self . client . as_ref ( ) . unwrap ( ) ;
19381940 let r = client. create_project ( name) . await ?;
19391941
1942+ let raw_json = r. raw_json . clone ( ) ;
1943+ let project = r. into_inner ( ) ;
1944+
19401945 match self . output_mode {
19411946 OutputMode :: Normal => {
1942- let project = r. into_inner ( ) ;
19431947 println ! ( "Created project '{}' with id {}" , project. name, project. id) ;
19441948 }
19451949 OutputMode :: Json => {
1946- println ! ( "{}" , r . raw_json) ;
1950+ println ! ( "{}" , raw_json) ;
19471951 }
19481952 }
19491953
1954+ self . ctx . set_project_id ( project. id ) ;
1955+ self . ctx . save_local_internal ( ) ?;
1956+
19501957 Ok ( ( ) )
19511958 }
19521959
0 commit comments