github.com/StackExchange/dnscontrol/v4@v4.11.0/documentation/fmt.md (about)

     1  # fmt
     2  
     3  This is a stand-alone utility to pretty-format your `dnsconfig.js` configuration file.
     4  
     5  ```shell
     6  NAME:
     7     dnscontrol fmt - [BETA] Format and prettify a given file
     8  
     9  USAGE:
    10     dnscontrol fmt [command options] [arguments...]
    11  
    12  CATEGORY:
    13     utility
    14  
    15  OPTIONS:
    16     --input value, -i value   Input file (default: "dnsconfig.js")
    17     --output value, -o value  Output file
    18     --help, -h                show help
    19  ```
    20  
    21  ## Examples
    22  
    23  By default the output goes to stdout:
    24  
    25  ```shell
    26  dnscontrol fmt >new-dnsconfig.js
    27  ```
    28  
    29  You can also redirect the output via the `-o` option:
    30  
    31  ```shell
    32  dnscontrol fmt -o new-dnsconfig.js
    33  ```
    34  
    35  The **safest** method involves making a backup first:
    36  
    37  ```shell
    38  cp dnsconfig.js dnsconfig.js.BACKUP
    39  dnscontrol fmt -i dnsconfig.js.BACKUP -o dnsconfig.js
    40  ```
    41  
    42  The **riskiest** method depends on the fact that DNSControl currently processes
    43  the `-o` file after the input file is completely read. It makes no backups.
    44  This is useful if Git is your backup mechanism.
    45  
    46  ```shell
    47  git commit -m'backup dnsconfig.js' dnsconfig.js
    48  dnscontrol fmt -o dnsconfig.js
    49  git diff -- dnsconfig.js
    50  ```