github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/commands/fmt.mdx (about) 1 --- 2 layout: docs 3 page_title: 'Commands: fmt' 4 description: | 5 Rewrite Nomad config and job files to canonical format 6 --- 7 8 # Command: fmt 9 10 The `fmt` commands check the syntax and rewrites Nomad configuration and jobspec 11 files to canonical format. It can be used to improve readability and enforce 12 consistency of style in Nomad files. 13 14 ## Usage 15 16 ```plaintext 17 nomad fmt [flags] paths ... 18 ``` 19 20 Formats Nomad agent configuration and job file to a canonical format. If a path 21 is a directory, it will recursively format all files with .nomad and .hcl 22 extensions in the directory. 23 24 If you provide a single dash (-) as argument, fmt will read from standard input 25 (STDIN) and output the processed output to standard output (STDOUT). 26 27 ## Format Options: 28 29 - `-list=false` : Don't list the files, which contain formatting inconsistencies. 30 - `-check` : Check if the files are valid HCL files. If not, exit status of the command 31 will be 1 and the incorrect files will not be formatted. 32 - `-write=false` : Don't overwrite the input files. 33 - `-recursive` : Process also files in subdirectories. By default only the given (or current) directory is processed. 34 35 ## Examples 36 37 ```shell-session 38 $ cat agent.hcl 39 server { 40 enabled = true 41 bootstrap_expect = 1 42 } 43 44 client { 45 enabled = true 46 } 47 48 $ nomad fmt 49 50 agent.hcl 51 $ cat agent.hcl 52 server { 53 enabled = true 54 bootstrap_expect = 1 55 } 56 57 client { 58 enabled = true 59 } 60 ```