fix: add ansi support and remove emoji

This commit is contained in:
2026-08-23 07:19:30 +05:00
parent 7dd2dd7f33
commit beab08cf67
5 changed files with 30 additions and 18 deletions
+10 -14
View File
@@ -33,11 +33,11 @@ pub fn deploy(name: &str, project: &Project, dry_run: bool) -> Result<()> {
for cmd in local_cmds {
let step = Instant::now();
if let Err(err) = local::execute(cmd, &project.workdir, &project.env) {
fail_line("🟢 [Local]", &format!("running: {cmd}..."), err.to_string());
fail_line("[Local]", &format!("running: {cmd}..."), err.to_string());
return Err(err);
}
success_line(
"🟢 [Local]",
"[Local]",
&format!("running: {cmd}..."),
"Success!",
step.elapsed(),
@@ -59,13 +59,13 @@ pub fn deploy(name: &str, project: &Project, dry_run: bool) -> Result<()> {
let label = format!("transferring {} to {}...", rule.source.display(), target);
match result {
Ok(stats) => success_line(
"🔵 [SFTP]",
"[SFTP]",
&label,
&format!("Done! ({stats})"),
step.elapsed(),
),
Err(err) => {
fail_line("🔵 [SFTP]", &label, err.to_string());
fail_line("[SFTP]", &label, err.to_string());
return Err(err);
}
}
@@ -74,15 +74,11 @@ pub fn deploy(name: &str, project: &Project, dry_run: bool) -> Result<()> {
for cmd in remote_cmds {
let step = Instant::now();
if let Err(err) = session.exec(cmd) {
fail_line(
"🟡 [Remote]",
&format!("running: {cmd}..."),
err.to_string(),
);
fail_line("[Remote]", &format!("running: {cmd}..."), err.to_string());
return Err(err);
}
success_line(
"🟡 [Remote]",
"[Remote]",
&format!("running: {cmd}..."),
"Success!",
step.elapsed(),
@@ -91,7 +87,7 @@ pub fn deploy(name: &str, project: &Project, dry_run: bool) -> Result<()> {
}
println!(
"🎉 {} (total {})",
"{} (total {})",
"Deploy successful!".green().bold(),
fmt_dur(total.elapsed())
);
@@ -101,17 +97,17 @@ pub fn deploy(name: &str, project: &Project, dry_run: bool) -> Result<()> {
fn print_plan(project: &Project, local_cmds: &[String], remote_cmds: &[String]) {
println!("dry-run plan:");
for cmd in local_cmds {
println!(" 🟢 [Local] {cmd}");
println!(" [Local] {cmd}");
}
for rule in &project.sync {
println!(
" 🔵 [SFTP] {} -> {}",
" [SFTP] {} -> {}",
rule.source.display(),
rule.target.display()
);
}
for cmd in remote_cmds {
println!(" 🟡 [Remote] {cmd}");
println!(" [Remote] {cmd}");
}
println!("{}", "nothing executed".dimmed());
}
+5
View File
@@ -12,6 +12,11 @@ use clap::Parser;
use colored::Colorize;
fn main() -> ExitCode {
#[cfg(windows)]
if enable_ansi_support::enable_ansi_support().is_err() {
colored::control::set_override(false);
}
let cli = cli::Cli::parse();
match run(&cli) {
Ok(()) => ExitCode::SUCCESS,