Skip to content

Commit

Permalink
Fixes hashicorp#30072 - Update documentation to show that the old DIR…
Browse files Browse the repository at this point in the history
… option can target a single file instead
  • Loading branch information
BrianSidebotham committed Jun 21, 2022
1 parent fd45fb9 commit 99e805c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions internal/command/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,15 +528,16 @@ func (c *FmtCommand) trimNewlines(tokens hclwrite.Tokens) hclwrite.Tokens {

func (c *FmtCommand) Help() string {
helpText := `
Usage: terraform [global options] fmt [options] [DIR]
Usage: terraform [global options] fmt [options] [TARGET]
Rewrites all Terraform configuration files to a canonical format. Both
configuration files (.tf) and variables files (.tfvars) are updated.
JSON files (.tf.json or .tfvars.json) are not modified.
If DIR is not specified then the current working directory will be used.
If DIR is "-" then content will be read from STDIN. The given content must
be in the Terraform language native syntax; JSON is not supported.
If TARGET is not specified then the current working directory will be
used. If TARGET is a file, only that file will be used. If TARGET is
"-" then content will be read from STDIN. The given content must be in
the Terraform language native syntax; JSON is not supported.
Options:
Expand Down
9 changes: 5 additions & 4 deletions website/docs/cli/commands/fmt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ and the generated files.

## Usage

Usage: `terraform fmt [options] [DIR]`
Usage: `terraform fmt [options] [TARGET]`

By default, `fmt` scans the current directory for configuration files. If
the `dir` argument is provided then it will scan that given directory
instead. If `dir` is a single dash (`-`) then `fmt` will read from standard
input (STDIN).
a directory is provided for the `target` argument then it will scan that
given directory instead. If `target` is a file then `fmt` will process just
that file, and if a single dash (`-`) then `fmt` will read from standard input
(STDIN).

The command-line flags are all optional. The list of available flags are:

Expand Down

0 comments on commit 99e805c

Please sign in to comment.