Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethengelman committed Aug 29, 2024
1 parent 77ce7a7 commit 4da9a8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
19 changes: 11 additions & 8 deletions cmd/soroban-cli/src/commands/contract/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::{
},
io::{self, Read, Write},
num::NonZeroU32,
path::Path,
path::{Path, PathBuf},
str,
sync::atomic::AtomicBool,
};
Expand Down Expand Up @@ -109,12 +109,12 @@ struct Runner {

impl Runner {
fn run(&self) -> Result<(), Error> {
let project_path = Path::new(&self.args.project_path);
let project_path = PathBuf::from(&self.args.project_path);
self.print
.infoln(format!("Initializing project at {project_path:?}"));

// create a project dir, and copy the contents of the base template (contract-init-template) into it
create_dir_all(project_path).map_err(|e| {
create_dir_all(&project_path).map_err(|e| {
self.print
.errorln("Error creating new project directory: {project_path:?}");
e
Expand All @@ -126,7 +126,7 @@ impl Runner {
return Ok(());
}

if !&self.args.frontend_template.is_empty() {
if !self.args.frontend_template.is_empty() {
// create a temp dir for the template repo
let fe_template_dir = tempfile::tempdir().map_err(|e| {
self.print
Expand All @@ -138,7 +138,7 @@ impl Runner {
self.clone_repo(&self.args.frontend_template, fe_template_dir.path())?;

// copy the frontend template files into the project
self.copy_frontend_files(fe_template_dir.path(), project_path)?;
self.copy_frontend_files(fe_template_dir.path(), &project_path)?;
}

// if there are --with-example flags, include the example contracts
Expand All @@ -156,7 +156,7 @@ impl Runner {
// copy the example contracts into the project
self.copy_example_contracts(
examples_dir.path(),
project_path,
&project_path,
&self.args.with_example,
)?;
}
Expand Down Expand Up @@ -203,7 +203,8 @@ impl Runner {
}

if exists {
self.print.overln(format!("Overwriting {to:?}"));
self.print
.plusln(format!("Writing {to:?} (overwriting existing file)"));
} else {
self.print.plusln(format!("Writing {to:?}"));
}
Expand Down Expand Up @@ -260,7 +261,9 @@ impl Runner {
}

if self.args.overwrite && !append {
self.print.overln(format!("Overwriting {new_path_str}"));
self.print.plusln(format!(
"Writing {new_path_str} (overwriting existing file)"
));
} else {
self.print.infoln(format!(
"Skipped creating {new_path_str} as it already exists"
Expand Down
1 change: 0 additions & 1 deletion cmd/soroban-cli/src/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ create_print_functions!(error, errorln, "❌");
create_print_functions!(globe, globeln, "🌎");
create_print_functions!(info, infoln, "ℹ️");
create_print_functions!(link, linkln, "🔗");
create_print_functions!(over, overln, "🔄");
create_print_functions!(plus, plusln, "➕");
create_print_functions!(save, saveln, "💾");
create_print_functions!(search, searchln, "🔎");
Expand Down

0 comments on commit 4da9a8d

Please sign in to comment.