diff options
author | Francis Lavoie <lavofr@gmail.com> | 2022-04-12 14:49:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-12 14:49:19 -0400 |
commit | 6512832f9f3904209ccb3c305e38ebde108083fb (patch) | |
tree | af0b674126e80469bd5baf8a485e73062074bb86 /cmd/commands.go | |
parent | 3e3bb00265f8fa0dd8ff3d33ce901776fd689f32 (diff) |
cmd: Add `--diff` option for `caddy fmt` (#4695)
Diffstat (limited to 'cmd/commands.go')
-rw-r--r-- | cmd/commands.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/commands.go b/cmd/commands.go index 0c68b7c..51960f3 100644 --- a/cmd/commands.go +++ b/cmd/commands.go @@ -282,12 +282,18 @@ human readability. It prints the result to stdout. If --overwrite is specified, the output will be written to the config file directly instead of printing it. +If --diff is specified, the output will be compared against the input, and +lines will be prefixed with '-' and '+' where they differ. Note that +unchanged lines are prefixed with two spaces for alignment, and that this +is not a valid patch format. + If you wish you use stdin instead of a regular file, use - as the path. When reading from stdin, the --overwrite flag has no effect: the result is always printed to stdout.`, Flags: func() *flag.FlagSet { fs := flag.NewFlagSet("fmt", flag.ExitOnError) fs.Bool("overwrite", false, "Overwrite the input file with the results") + fs.Bool("diff", false, "Print the differences between the input file and the formatted output") return fs }(), }) |