-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd: Add --diff
option for caddy fmt
#4695
Conversation
I'm curious what would be the output if there isn't a new line at the end of the file |
It'll show it:
|
This is cool. I do wonder if it'd be useful to output an actual patch format so that diffing tools can visualize it for the user. |
There's https://github.com/google/go-patchutils that we could use to do that, but it pulls in additional deps, not sure we need the complexity. I don't think we really gain that much from a full-on patch here. If you want a real patch, make it yourself with your machine's |
I see... Do we really need this at all then? If the pipe to diff can be done anyway nearly just as easily? |
Piping on Windows is uh, not nice 😁 I wrote this because I was on Windows and wanted a way to compare quickly in environments where I can't easily add random tooling. Some Windows users who see the warning in their logs might appreciate having this too for example. Or people in Docker who don't feel like getting a Caddy binary outside Docker just to compare their fmt. |
As a Windows user I can relate to your Windows experience. Actually it was the new line at the end that kept causing the warning. |
cd298c0
to
c410537
Compare
Just thought this might be fun to have.
When using no options or using
--overwrite
, it can be difficult to find out what was actually "wrong" according to the formatter.Example output where a couple of the lines had spaces instead of tabs: