Skip to content

Commit 4da9a8d

Browse files
Address PR feedback
1 parent 77ce7a7 commit 4da9a8d

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

cmd/soroban-cli/src/commands/contract/init.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::{
1414
},
1515
io::{self, Read, Write},
1616
num::NonZeroU32,
17-
path::Path,
17+
path::{Path, PathBuf},
1818
str,
1919
sync::atomic::AtomicBool,
2020
};
@@ -109,12 +109,12 @@ struct Runner {
109109

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

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

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

140140
// copy the frontend template files into the project
141-
self.copy_frontend_files(fe_template_dir.path(), project_path)?;
141+
self.copy_frontend_files(fe_template_dir.path(), &project_path)?;
142142
}
143143

144144
// if there are --with-example flags, include the example contracts
@@ -156,7 +156,7 @@ impl Runner {
156156
// copy the example contracts into the project
157157
self.copy_example_contracts(
158158
examples_dir.path(),
159-
project_path,
159+
&project_path,
160160
&self.args.with_example,
161161
)?;
162162
}
@@ -203,7 +203,8 @@ impl Runner {
203203
}
204204

205205
if exists {
206-
self.print.overln(format!("Overwriting {to:?}"));
206+
self.print
207+
.plusln(format!("Writing {to:?} (overwriting existing file)"));
207208
} else {
208209
self.print.plusln(format!("Writing {to:?}"));
209210
}
@@ -260,7 +261,9 @@ impl Runner {
260261
}
261262

262263
if self.args.overwrite && !append {
263-
self.print.overln(format!("Overwriting {new_path_str}"));
264+
self.print.plusln(format!(
265+
"Writing {new_path_str} (overwriting existing file)"
266+
));
264267
} else {
265268
self.print.infoln(format!(
266269
"Skipped creating {new_path_str} as it already exists"

cmd/soroban-cli/src/print.rs

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ create_print_functions!(error, errorln, "❌");
8686
create_print_functions!(globe, globeln, "🌎");
8787
create_print_functions!(info, infoln, "ℹ️");
8888
create_print_functions!(link, linkln, "🔗");
89-
create_print_functions!(over, overln, "🔄");
9089
create_print_functions!(plus, plusln, "➕");
9190
create_print_functions!(save, saveln, "💾");
9291
create_print_functions!(search, searchln, "🔎");

0 commit comments

Comments
 (0)