mirror of
https://github.com/house-of-vanity/rexec.git
synced 2025-07-06 16:44:08 +00:00
Improved logging and formatting.
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1111,7 +1111,7 @@ checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rexec"
|
name = "rexec"
|
||||||
version = "1.3.0"
|
version = "1.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"brace-expand",
|
"brace-expand",
|
||||||
"clap 4.3.4",
|
"clap 4.3.4",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rexec"
|
name = "rexec"
|
||||||
version = "1.3.0"
|
version = "1.3.1"
|
||||||
readme = "https://github.com/house-of-vanity/rexec#readme"
|
readme = "https://github.com/house-of-vanity/rexec#readme"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Parallel SSH executor"
|
description = "Parallel SSH executor"
|
||||||
|
10
src/main.rs
10
src/main.rs
@ -25,7 +25,7 @@ use regex::Regex;
|
|||||||
#[command(author = "AB ab@hexor.ru", version, about = "Parallel SSH executor in Rust", long_about = None)]
|
#[command(author = "AB ab@hexor.ru", version, about = "Parallel SSH executor in Rust", long_about = None)]
|
||||||
struct Args {
|
struct Args {
|
||||||
/// Username for SSH connections (defaults to current system user)
|
/// 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,
|
username: String,
|
||||||
|
|
||||||
/// Flag to use known_hosts file for server discovery instead of pattern expansion
|
/// 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 display_name_stdout = display_name.clone();
|
||||||
let stdout_thread = thread::spawn(move || {
|
let stdout_thread = thread::spawn(move || {
|
||||||
let reader = BufReader::new(stdout);
|
let reader = BufReader::new(stdout);
|
||||||
let prefix = format!("{}", "│".green());
|
let prefix = format!("{}", "║".green());
|
||||||
|
|
||||||
for line in reader.lines() {
|
for line in reader.lines() {
|
||||||
match line {
|
match line {
|
||||||
Ok(line) => println!("{} {} - {}", prefix, display_name_stdout.yellow(), line),
|
Ok(line) => println!("{} {} {} {}", prefix, display_name_stdout.yellow(), prefix, line),
|
||||||
Err(_) => break,
|
Err(_) => break,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -335,7 +335,7 @@ fn execute_ssh_command(hostname: &str, username: &str, command: &str, common_suf
|
|||||||
|
|
||||||
for line in reader.lines() {
|
for line in reader.lines() {
|
||||||
match line {
|
match line {
|
||||||
Ok(line) => println!("{} {} - {}", prefix, display_name_stderr.yellow(), line),
|
Ok(line) => println!("{} {} {} {}", prefix, display_name_stderr.yellow(), prefix, line),
|
||||||
Err(_) => break,
|
Err(_) => break,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -701,4 +701,4 @@ fn main() {
|
|||||||
// Use the embedded massh library implementation
|
// Use the embedded massh library implementation
|
||||||
execute_with_massh(&valid_hosts, &args.username, &args.command, args.parallel, args.code, &common_suffix);
|
execute_with_massh(&valid_hosts, &args.username, &args.command, args.parallel, args.code, &common_suffix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user