diff --git a/command/fmt.go b/command/fmt.go index e4e9aad2f..49e06c08e 100644 --- a/command/fmt.go +++ b/command/fmt.go @@ -24,8 +24,8 @@ func (c *FmtCommand) Run(args []string) int { args = c.Meta.process(args, false) cmdFlags := flag.NewFlagSet("fmt", flag.ContinueOnError) - cmdFlags.BoolVar(&c.opts.List, "list", false, "list") - cmdFlags.BoolVar(&c.opts.Write, "write", false, "write") + cmdFlags.BoolVar(&c.opts.List, "list", true, "list") + cmdFlags.BoolVar(&c.opts.Write, "write", true, "write") cmdFlags.BoolVar(&c.opts.Diff, "diff", false, "diff") cmdFlags.Usage = func() { c.Ui.Error(c.Help()) } diff --git a/command/fmt_test.go b/command/fmt_test.go index 3d284e466..d38d54644 100644 --- a/command/fmt_test.go +++ b/command/fmt_test.go @@ -1,7 +1,7 @@ package command import ( - "bytes" + "fmt" "io/ioutil" "os" "path/filepath" @@ -88,8 +88,8 @@ func TestFmt_workingDirectory(t *testing.T) { t.Fatalf("wrong exit code. errors: \n%s", ui.ErrorWriter.String()) } - expected := fmtFixture.golden - if actual := ui.OutputWriter.Bytes(); !bytes.Equal(actual, expected) { + expected := fmt.Sprintf("%s\n", fmtFixture.filename) + if actual := ui.OutputWriter.String(); actual != expected { t.Fatalf("got: %q\nexpected: %q", actual, expected) } } diff --git a/website/source/docs/commands/fmt.html.markdown b/website/source/docs/commands/fmt.html.markdown index 383f58d1d..7e5d7647b 100644 --- a/website/source/docs/commands/fmt.html.markdown +++ b/website/source/docs/commands/fmt.html.markdown @@ -19,6 +19,6 @@ Usage: `terraform fmt [options] [DIR]` The command-line flags are all optional. The list of available flags are: -* `-list=false` - List files whose formatting differs -* `-write=false` - Write result to source file instead of STDOUT +* `-list=true` - List files whose formatting differs +* `-write=true` - Write result to source file instead of STDOUT * `-diff=false` - Display diffs instead of rewriting files