From 64c128095182b0fe479d3be48f52c6d90c1f9d5b Mon Sep 17 00:00:00 2001 From: Dan Carley Date: Fri, 29 Apr 2016 00:39:53 +0100 Subject: [PATCH] command/fmt: Improve documentation for -diff and defaults (#6398) * command/fmt: Document -diff doesn't disable -write As noted in hashicorp/terraform#6343, this description misleadingly suggested that the `-diff` option disables the `-write` option. This isn't the case and because of the default options (described in c753390) the behaviour of `terraform fmt -diff` is actually the same as `terraform fmt -write -list -diff`. Replace the "instead of rewriting" description to clarify that. Documentation in hcl/fmtcmd is corrected in hashicorp/hcl#117 but it's not really necessary to bump the dependency version. * command/fmt: Show flag defaults in help text These were documented on the website but not in the `-help` text. This should help to clarify that you need to pass `-list=false -write=false -diff` if you only want to see diffs. Accordingly I've replaced the word "disabled" with "always false" in the STDIN special cases so that it matches the terminology used in the defaults and better indicates that it is overridden. NB: The 3x duplicated defaults and documentation makes me feel uneasy once again. I'm not sure how to solve that, though. --- command/fmt.go | 6 +++--- website/source/docs/commands/fmt.html.markdown | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/command/fmt.go b/command/fmt.go index d9ccc2643..0b06d7b50 100644 --- a/command/fmt.go +++ b/command/fmt.go @@ -79,11 +79,11 @@ Usage: terraform fmt [options] [DIR] Options: - -list List files whose formatting differs (disabled if using STDIN) + -list=true List files whose formatting differs (always false if using STDIN) - -write Write result to source file instead of STDOUT (disabled if using STDIN) + -write=true Write result to source file instead of STDOUT (always false if using STDIN) - -diff Display diffs instead of rewriting files + -diff=false Display diffs of formatting changes ` return strings.TrimSpace(helpText) diff --git a/website/source/docs/commands/fmt.html.markdown b/website/source/docs/commands/fmt.html.markdown index bb48ae957..96e2be19e 100644 --- a/website/source/docs/commands/fmt.html.markdown +++ b/website/source/docs/commands/fmt.html.markdown @@ -25,4 +25,4 @@ The command-line flags are all optional. The list of available flags are: * `-list=true` - List files whose formatting differs (disabled if using STDIN) * `-write=true` - Write result to source file instead of STDOUT (disabled if using STDIN) -* `-diff=false` - Display diffs instead of rewriting files +* `-diff=false` - Display diffs of formatting changes