diff --git a/Cargo.lock b/Cargo.lock index 9ae2417..63ec200 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -401,7 +401,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rexec" -version = "1.4.0" +version = "1.5.0" dependencies = [ "brace-expand", "clap", diff --git a/Cargo.toml b/Cargo.toml index 9893c8a..4014bc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rexec" -version = "1.5.0" +version = "1.5.1" readme = "https://github.com/house-of-vanity/rexec#readme" edition = "2021" description = "Parallel SSH executor" diff --git a/src/main.rs b/src/main.rs index d680807..f90680d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -315,7 +315,7 @@ fn execute_ssh_command( }; // Function to handle output lines with proper block management - let handle_output = |line: String, display_name: &str, code_only: bool| { + let handle_output = |line: String, display_name: &str, code_only: bool, is_stderr: bool| { if !code_only { let mut current_block = CURRENT_BLOCK.lock().unwrap(); @@ -338,8 +338,19 @@ fn execute_ssh_command( } } - // Print the log line - println!("│ {} │ {}", display_name.yellow(), line); + // Print the log line with colored separator based on stream type + let separator = if is_stderr { + "│".red() + } else { + "│".green() + }; + println!( + "{} {} {} {}", + separator, + display_name.yellow(), + separator, + line + ); } }; @@ -353,7 +364,8 @@ fn execute_ssh_command( for line in reader.lines() { match line { Ok(line) => { - handle_output(line, &display_name_stdout, code_only_stdout); + handle_output(line, &display_name_stdout, code_only_stdout, false); + // false = stdout } Err(_) => break, } @@ -370,7 +382,8 @@ fn execute_ssh_command( for line in reader.lines() { match line { Ok(line) => { - handle_output(line, &display_name_stderr, code_only_stderr); + handle_output(line, &display_name_stderr, code_only_stderr, true); + // true = stderr } Err(_) => break, }