From d32246601247b4376c1a0d15e79f71b8c2ff0d8c Mon Sep 17 00:00:00 2001 From: h-dav Date: Thu, 2 Mar 2023 16:43:50 +0000 Subject: [PATCH 1/2] cargo shuttle init does not handle directory argument properly Issue #665 skip over prompting for directory name if directory name is specified in init command not solved issue of file path being created properly as don't have time right now but will look into this later --- cargo-shuttle/src/lib.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index c6d149d42..a6220e881 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -152,12 +152,17 @@ impl Shuttle { // 3. Confirm the project directory let path = if interactive { - println!("Where should we create this project?"); - let directory_str: String = Input::with_theme(&theme) - .with_prompt("Directory") - .default(".".to_owned()) - .interact()?; - println!(); + let mut directory_str: String = String::new(); + if project_args.working_directory.is_none() { + println!("Where should we create this project?"); + directory_str = Input::with_theme(&theme) + .with_prompt("Directory") + .default(".".to_owned()) + .interact()?; + println!(); + } else { + directory_str = project.working_directory; + } args::parse_init_path(OsString::from(directory_str))? } else { args.path.clone() From a93757561c9c69c69f0d8dd213df57cab548c3cc Mon Sep 17 00:00:00 2001 From: h-dav Date: Thu, 2 Mar 2023 16:43:50 +0000 Subject: [PATCH 2/2] cargo shuttle init does not handle directory argument properly Issue #665 skip over prompting for directory name if directory name is specified in init command not solved issue of file path being created properly as don't have time right now but will look into this later --- cargo-shuttle/src/lib.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index c6d149d42..b21430243 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -152,12 +152,20 @@ impl Shuttle { // 3. Confirm the project directory let path = if interactive { - println!("Where should we create this project?"); - let directory_str: String = Input::with_theme(&theme) - .with_prompt("Directory") - .default(".".to_owned()) - .interact()?; - println!(); + let mut directory_str: String = String::new(); + if project_args.working_directory.as_os_str().is_empty() { + println!("Where should we create this project?"); + directory_str = Input::with_theme(&theme) + .with_prompt("Directory") + .default(".".to_owned()) + .interact()?; + println!(); + } else { + directory_str = project_args.working_directory + .into_os_string() + .into_string() + .unwrap()?; + } args::parse_init_path(OsString::from(directory_str))? } else { args.path.clone()