Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Trojan295 authored and tgross committed Oct 6, 2022
1 parent 7e8b4ff commit b4eada2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ hclfmt: ## Format HCL files with hclfmt
-o -name '.next' -prune \
-o -path './ui/dist' -prune \
-o -path './website/out' -prune \
-o -path './command/testdata' -prune \
-o \( -name '*.nomad' -o -name '*.hcl' -o -name '*.tf' \) \
-print0 | xargs -0 hclfmt -w

Expand Down
2 changes: 1 addition & 1 deletion command/testdata/fmt/job.in.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion command/testdata/fmt/job.out.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ job "job1" {
}
}
}
}
}
22 changes: 12 additions & 10 deletions website/content/docs/commands/fmt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ consistency of style in Nomad files.
nomad fmt [flags] paths ...
```

Formats Nomad agent configuration and job file to a canonical format.
If a path is a directory, it will recursively format all files
with .nomad and .hcl extensions in the directory.
If you provide a single dash (-) as argument, fmt will read from standard
input (STDIN) and output the processed output to standard output (STDOUT).
Formats Nomad agent configuration and job file to a canonical format. If a path
is a directory, it will recursively format all files with .nomad and .hcl
extensions in the directory.

If you provide a single dash (-) as argument, fmt will read from standard input
(STDIN) and output the processed output to standard output (STDOUT).

## Format Options:

- `-list=false` : Don't list the files, which contain formatting inconsistencies.
- `-check` : Check if the files are valid HCL files. If not, exit status of the command
will be 1 and the incorrect files will not be formatted.
- `-list=false` : Don't list the files, which contain formatting inconsistencies.
- `-check` : Check if the files are valid HCL files. If not, exit status of the command
will be 1 and the incorrect files will not be formatted.
- `-write=false` : Don't overwrite the input files.
- `-recursive` : Process also files in subdirectories. By default only the given (or current) directory is processed.
- `-recursive` : Process also files in subdirectories. By default only the given (or current) directory is processed.

## Examples

Expand All @@ -44,7 +44,9 @@ server {
client {
enabled = true
}
$ nomad fmt
agent.hcl
$ cat agent.hcl
server {
Expand Down
4 changes: 4 additions & 0 deletions website/data/docs-nav-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@
}
]
},
{
"title": "fmt",
"path": "commands/fmt"
},
{
"title": "job",
"routes": [
Expand Down

0 comments on commit b4eada2

Please sign in to comment.