Improve readability

This commit is contained in:
2023-09-07 15:04:51 +03:00
parent b360e29666
commit 080ce8984a
2 changed files with 26 additions and 30 deletions

2
Cargo.lock generated
View File

@ -1066,7 +1066,7 @@ checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
[[package]]
name = "rexec"
version = "1.0.6"
version = "1.0.8"
dependencies = [
"brace-expand",
"clap 4.3.4",

View File

@ -52,14 +52,6 @@ struct Args {
)]
noconfirm: bool,
#[arg(
short = 'b',
long,
default_value_t = true,
help = "Use formatting for better human readability"
)]
beauty: bool,
#[arg(short, long, default_value_t = 100)]
parallel: i32,
}
@ -275,37 +267,41 @@ fn main() {
} else {
format!("{}", output.exit_status.to_string().red())
};
println!("{}", format!("Exit code [{}] / stdout {} bytes / stderr {} bytes", code_string, output.stdout.len(), output.stderr.len()).bold());
println!(
"{}",
format!(
"Exit code [{}] / stdout {} bytes / stderr {} bytes",
code_string,
output.stdout.len(),
output.stderr.len()
)
.bold()
);
if !args.code {
match String::from_utf8(output.stdout) {
Ok(stdout) => {
match stdout.as_str() {
"" => {}
_ => {
println!("{}", "STDOUT".bold().blue());
for line in stdout.lines() {
println!("{} {}", "".green(), line);
}
Ok(stdout) => match stdout.as_str() {
"" => {}
_ => {
println!("{}", "STDOUT".bold().blue());
for line in stdout.lines() {
println!("{} {}", "".green(), line);
}
}
}
},
Err(_) => {}
}
match String::from_utf8(output.stderr) {
Ok(stderr) => {
match stderr.as_str() {
"" => {}
_ => {
println!("{}", "STDERR".bold().bright_red());
for line in stderr.lines() {
println!("{} {}", "".red(), line);
}
Ok(stderr) => match stderr.as_str() {
"" => {}
_ => {
println!("{}", "STDERR".bold().bright_red());
for line in stderr.lines() {
println!("{} {}", "".red(), line);
}
}
}
},
Err(_) => {}
}
}