Request for update of the usage of `caddy fmt` on the site

The document on the site shows the usage of caddy fmt:

caddy fmt [<path>]
	[--overwrite]

but the valid usage is:

usage:
  caddy fmt [--overwrite] [<path>]

(source)

Some test results here:

DIRTY_CADDYFILE="localhost {   \n\treverse_proxy /api/* localhost:9001\n    file_server\n}\n\n"
echo -e $DIRTY_CADDYFILE > Caddyfile

# Doesn't work
docker run -v $PWD/Caddyfile:/srv/Caddyfile:rw caddy:2.4.2 caddy fmt Caddyfile --overwrite

# Same
docker run -v $PWD/Caddyfile:/srv/Caddyfile:rw caddy:2.4.2 caddy fmt Caddyfile -overwrite

# Works
docker run -v $PWD/Caddyfile:/srv/Caddyfile:rw caddy:2.4.2 caddy fmt --overwrite Caddyfile

# Same
docker run -v $PWD/Caddyfile:/srv/Caddyfile:rw caddy:2.4.2 caddy fmt -overwrite Caddyfile
1 Like

Interesting. That’s more of a bug than a documentation issue.

FYI, you may omit the Caddyfile argument since that’s the default.

I think that’s a documentation bug, actually. Usually flagged arguments need to come first.

This topic was automatically closed after 90 days. New replies are no longer allowed.