Do not add newline at eof with --no-format option

This commit is contained in:
Fabrice Reix 2023-01-22 18:17:08 +01:00
parent 2339a3290d
commit c4226aa08b
No known key found for this signature in database
GPG Key ID: 8D3D9DBDD96B2D30

View File

@ -239,10 +239,10 @@ fn main() {
process::exit(1);
}
};
let output = if output.ends_with('\n') {
output
} else {
let output = if !output.ends_with('\n') && !cli::has_flag(&matches, "no_format") {
format!("{}\n", output)
} else {
output
};
write_output(output.into_bytes(), output_file.as_deref());
}