From 233311dda126a70aaa25e3df2da9879bc9f652a3 Mon Sep 17 00:00:00 2001 From: oddgrd <29732646+oddgrd@users.noreply.github.com> Date: Fri, 9 Dec 2022 13:33:24 +0100 Subject: [PATCH] feat: create `init` project from correct dir --- cargo-shuttle/src/lib.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index 1cee23b25..761ebd6a6 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -173,7 +173,7 @@ impl Shuttle { // 5. Initialize locally init::cargo_init(path.clone())?; - init::cargo_shuttle_init(path, framework)?; + init::cargo_shuttle_init(path.clone(), framework)?; println!(); // 6. Confirm that the user wants to create the project environment on Shuttle @@ -182,12 +182,20 @@ impl Shuttle { } else if args.new { true } else { - Confirm::with_theme(&theme) + let should_create = Confirm::with_theme(&theme) .with_prompt("Do you want to create the project environment on Shuttle?") .default(true) - .interact()? + .interact()?; + + println!(); + should_create }; + if should_create_environment { + // Set the project working directory path to the init path, + // so `load_project` is ran with the correct project path + project_args.working_directory = path; + self.load_project(&mut project_args)?; let mut client = Client::new(self.ctx.api_url()); client.set_api_key(self.ctx.api_key()?);