mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-22 11:00:53 +08:00
cmd: make caddy fmt
hints more clear (#5378)
This commit is contained in:
parent
5ded580444
commit
bf54892a73
|
@ -88,7 +88,7 @@ func FormattingDifference(filename string, body []byte) (caddyconfig.Warning, bo
|
||||||
return caddyconfig.Warning{
|
return caddyconfig.Warning{
|
||||||
File: filename,
|
File: filename,
|
||||||
Line: line,
|
Line: line,
|
||||||
Message: "Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies",
|
Message: "Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies",
|
||||||
}, true
|
}, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -589,7 +589,10 @@ func cmdFmt(fl Flags) (int, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if warning, diff := caddyfile.FormattingDifference(formatCmdConfigFile, input); diff {
|
if warning, diff := caddyfile.FormattingDifference(formatCmdConfigFile, input); diff {
|
||||||
return caddy.ExitCodeFailedStartup, fmt.Errorf("%s:%d: Caddyfile input is not formatted", warning.File, warning.Line)
|
return caddy.ExitCodeFailedStartup, fmt.Errorf(`%s:%d: Caddyfile input is not formatted; Tip: use '--overwrite' to update your Caddyfile in-place instead of previewing it. Consult '--help' for more options`,
|
||||||
|
warning.File,
|
||||||
|
warning.Line,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return caddy.ExitCodeSuccess, nil
|
return caddy.ExitCodeSuccess, nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user