-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
caddy fmt
will silently ignore all but the first file path passed to it
#6702
Comments
Thanks for the report. Should be an easy fix, I suppose -- anyone is welcome to contribute! |
Noting in case I have time to pick this up: this looks like the relevant function. Lines 561 to 619 in eddbccd
|
Well, you can only have one root Caddyfile, so I don't think it really makes sense to try to format more than one. If you're doing that because you have So I think yeah disallowing more than one file probably makes sense. Also while we're at it I think we could add |
Yeah, imported files is precisely where I ran into this. |
If you call
caddy fmt
with the path to more than one file, it only formats the first file.For example:
$ caddy fmt 1.Caddyfile 2.Caddyfile --overwrite
then
1.Caddyfile
will be reformatted, but2.Caddyfile
will be silently ignored.If I look in the docs, I can see that
caddy fmt
only supports passing a single path – but it took me a while to realise that! This is different from other formatting tools I've used (e.g.black
,terraform fmt
) where you can pass multiple files and format them all together.I think it would be less confusing if
caddy fmt
either:<path>
passed to it, or<path>
Context
I'd written a command to find all the Caddyfiles in my repo and format them:
and I was getting inconsistent results between different machines – it took me a while to notice that
find
was returning results in an inconsistent order, andcaddy
was only formatting the first in the list.I don't really mind what
caddy
does, but the current behaviour caused a lot of confusion.Version
The text was updated successfully, but these errors were encountered: