mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05: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
1 changed files with 4 additions and 1 deletions
|
@ -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 a new issue