Skip to content

Commit

Permalink
use eprintln macro for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnxpl0it committed Dec 14, 2024
1 parent bff3b31 commit 9de9aba
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ content = '''
keywords.insert(Keywords::from(key.to_string(), None), value_str);
}
} else {
println!(
eprintln!(
"\n[{}] {}\n",
"INFO".bold().blue(),
"Looks like it's your first time running spark, creating config files and templates for you".green()
Expand Down
2 changes: 1 addition & 1 deletion src/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn main() {
parsed_template.set_options(options);
parsed_template.extract(&mut keywords);
} else {
println!(
eprintln!(
"{} {}",
"No args specified please use".yellow(),
"--help".bold().green()
Expand Down
5 changes: 2 additions & 3 deletions src/core/funcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl Fns {
if let Ok(value) = Self::exec(function, keyword_name) {
match function {
Self::None => {
println!(
eprintln!(
"\n[{}] {}: {}",
"WRN".yellow(),
"Value not found".yellow(),
Expand All @@ -122,9 +122,8 @@ impl Fns {
}
}
}
} else {
// Ignore
}

keywords
}
}
9 changes: 5 additions & 4 deletions src/core/templates/options/git/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ pub fn check_git() -> Result<(), String> {
}

pub fn git_init(project_root: &str) {

if let Err(e) = check_git() {
println!("{}: {}", "error".red().bold(), e.red().bold());
eprintln!("{}: {}", "error".red().bold(), e.red().bold());
return;
}

if let Err(e) = std::env::set_current_dir(project_root) {
println!(
eprintln!(
"{}: {}",
"error".red().bold(),
format!("Failed to change directory: {}", e).red().bold()
Expand All @@ -32,14 +33,14 @@ pub fn git_init(project_root: &str) {
if status.success() {
println!("{}", "\n✅ Git initialized successfully.".green().bold());
} else {
println!(
eprintln!(
"{}: {}",
"error".red().bold(),
"Git initialization failed.".red().bold()
);
}
} else {
println!(
eprintln!(
"{}: {}",
"error".red().bold(),
"Failed to run git command.".red().bold()
Expand Down

0 comments on commit 9de9aba

Please sign in to comment.