Skip to content

Commit 06baea9

Browse files
authored
Merge pull request #31286 from BrianSidebotham/update_docs_for_30072
Fixes #30072 - Update docs to show single file usage
2 parents a30d1c4 + a6aa759 commit 06baea9

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

internal/command/fmt.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -528,15 +528,18 @@ func (c *FmtCommand) trimNewlines(tokens hclwrite.Tokens) hclwrite.Tokens {
528528

529529
func (c *FmtCommand) Help() string {
530530
helpText := `
531-
Usage: terraform [global options] fmt [options] [DIR]
531+
Usage: terraform [global options] fmt [options] [TARGET]
532532
533-
Rewrites all Terraform configuration files to a canonical format. Both
534-
configuration files (.tf) and variables files (.tfvars) are updated.
535-
JSON files (.tf.json or .tfvars.json) are not modified.
533+
Rewrites all Terraform configuration files to a canonical format. Both
534+
configuration files (.tf) and variables files (.tfvars) are updated.
535+
JSON files (.tf.json or .tfvars.json) are not modified.
536536
537-
If DIR is not specified then the current working directory will be used.
538-
If DIR is "-" then content will be read from STDIN. The given content must
539-
be in the Terraform language native syntax; JSON is not supported.
537+
If TARGET is not specified, the command uses the current working directory.
538+
If TARGET is a file, the command only uses the specified file. If TARGET
539+
is "-" then the command reads from STDIN.
540+
541+
The content must be in the Terraform language native syntax; JSON is not
542+
supported.
540543
541544
Options:
542545

website/docs/cli/commands/fmt.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,10 @@ and the generated files.
4545

4646
## Usage
4747

48-
Usage: `terraform fmt [options] [DIR]`
48+
Usage: `terraform fmt [options] [TARGET]`
4949

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

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

0 commit comments

Comments
 (0)