Closed milahu closed 2 years ago
I like the idea of removing potential extra newlines added by println!
, however with the implementation in this PR, other command options, such as just reading a value would not have a newline after them, leading to a weird terminal output. I'm thinking instead I might add a strip
and then println!
, that way it is predictable that there will be one and only one newline at the end
the tool should minimize diff noise
if the user has a million newlines at the end of his configuration.nix, then so be it
to prettify nix code, we have other tools like nixpkgs-fmt and alejandra
I agree about the diff noise, perhaps a better alternative would be to check what output is being printed and then print a newline depending on the query, however since the user is simply printing something out to the console, I don't see changing or adding a newline to the end as an issue. If a user wants to use the unmodified output for something they could use nix-editor -o output
rather than nix-editor something > output
. I think I'll just add a --raw
option to print without edits or newlines (including values), and trim otherwise
651e2a323a586bcc5693bf896a1faa4014361207
thanks, this is better
- println!("{}", output);
+ println!("{}", output.trim());
trimming should be optional via --trim
... but well, nix-editor --raw
will do
fix #8