mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-22 04:19:53 +08:00
cmd: fmt
exit successfully after overwriting config file (#5351)
Fixes https://github.com/caddyserver/caddy/issues/5349
This commit is contained in:
parent
201b9b41f9
commit
8c0b49bf03
|
@ -558,7 +558,10 @@ func cmdFmt(fl Flags) (int, error) {
|
|||
if err := os.WriteFile(formatCmdConfigFile, output, 0600); err != nil {
|
||||
return caddy.ExitCodeFailedStartup, fmt.Errorf("overwriting formatted file: %v", err)
|
||||
}
|
||||
} else if fl.Bool("diff") {
|
||||
return caddy.ExitCodeSuccess, nil
|
||||
}
|
||||
|
||||
if fl.Bool("diff") {
|
||||
diff := difflib.Diff(
|
||||
strings.Split(string(input), "\n"),
|
||||
strings.Split(string(output), "\n"))
|
||||
|
|
Loading…
Reference in New Issue
Block a user