Skip to content

Commit

Permalink
Fix log formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunkomath committed Jul 7, 2024
1 parent 5a03008 commit 73cd7fe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ impl Worker {
let amp_file = html_file.replace("index.html", "amp/index.html");
log.success(&format!(
"{} {} {}",
"Generated".green(),
"Generated".green(),
"AMP ".blue(),
&amp_file
));
Expand Down
21 changes: 10 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,17 @@ async fn main() -> Result<()> {

match args.command {
Commands::New { project_dir, theme } => {
log.activity("Creating new project");
create::project(&project_dir, &theme).await.map_err(|e| {
log.error(&e.to_string());
anyhow::anyhow!("Failed to create project: {}", e)
})?;

match create::project(&project_dir, &theme).await {
Err(e) => {
log.error(&e.to_string());
}
_ => {
// Create settings file
create::settings_file(&project_dir)?;
log.info(&format!("Project created in {}", project_dir.display()));
}
}
create::settings_file(&project_dir).map_err(|e| {
log.error(&e.to_string());
anyhow::anyhow!("Failed to create settings file: {}", e)
})?;

log.activity(&format!("Project created in {}", project_dir.display()));
}
Commands::Dev { input_dir, watch } => {
if utils::path_to_string(&input_dir)? == utils::path_to_string(&env::current_dir()?)? {
Expand Down
4 changes: 2 additions & 2 deletions src/shared/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ impl Logger {
}

pub fn info(&self, message: &str) {
println!("- {}", message.blue());
println!("{}", message.blue());
}

pub fn activity(&self, message: &str) {
println!("\n- {}...", message.bold());
println!("- {}...", message.bold());
}

pub fn success(&self, message: &str) {
Expand Down

0 comments on commit 73cd7fe

Please sign in to comment.