Improved logging and formatting.

This commit is contained in:
Ultradesu
2025-05-07 14:35:01 +03:00
parent 971c6176e6
commit 94fd8535ca
3 changed files with 7 additions and 7 deletions

2
Cargo.lock generated
View File

@ -1111,7 +1111,7 @@ checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
[[package]]
name = "rexec"
version = "1.3.0"
version = "1.3.1"
dependencies = [
"brace-expand",
"clap 4.3.4",

View File

@ -1,6 +1,6 @@
[package]
name = "rexec"
version = "1.3.0"
version = "1.3.1"
readme = "https://github.com/house-of-vanity/rexec#readme"
edition = "2021"
description = "Parallel SSH executor"

View File

@ -25,7 +25,7 @@ use regex::Regex;
#[command(author = "AB ab@hexor.ru", version, about = "Parallel SSH executor in Rust", long_about = None)]
struct Args {
/// Username for SSH connections (defaults to current system user)
#[arg(short, long, default_value_t = whoami::username())]
#[arg(short = 'u', short = 'l', long, default_value_t = whoami::username())]
username: String,
/// Flag to use known_hosts file for server discovery instead of pattern expansion
@ -316,11 +316,11 @@ fn execute_ssh_command(hostname: &str, username: &str, command: &str, common_suf
let display_name_stdout = display_name.clone();
let stdout_thread = thread::spawn(move || {
let reader = BufReader::new(stdout);
let prefix = format!("{}", "".green());
let prefix = format!("{}", "".green());
for line in reader.lines() {
match line {
Ok(line) => println!("{} {} - {}", prefix, display_name_stdout.yellow(), line),
Ok(line) => println!("{} {} {} {}", prefix, display_name_stdout.yellow(), prefix, line),
Err(_) => break,
}
}
@ -335,7 +335,7 @@ fn execute_ssh_command(hostname: &str, username: &str, command: &str, common_suf
for line in reader.lines() {
match line {
Ok(line) => println!("{} {} - {}", prefix, display_name_stderr.yellow(), line),
Ok(line) => println!("{} {} {} {}", prefix, display_name_stderr.yellow(), prefix, line),
Err(_) => break,
}
}