hornet fmt¶
Reformat a named.conf file in-place using Hornet's canonical style.
Usage¶
hornet fmt [OPTIONS] <FILE>
Arguments:
<FILE> Path to named.conf
Options:
-i, --indent <N> Indent size in spaces [default: 4]
--check Check formatting only; exit 1 if file would change
--modern Use modern keyword aliases [default: true]
--no-modern Keep legacy keywords
-h, --help Print help
Examples¶
Reformat in-place¶
Output:
Check-only mode (CI / pre-commit)¶
Output when already formatted:
Output when reformatting would change the file (exits 1):
Use 2-space indent¶
Preserve legacy keywords¶
Exit codes¶
| Code | Meaning |
|---|---|
0 |
Success (file formatted, or --check and file was already correct) |
1 |
Parse error; or --check and file would have been changed |
CI integration¶
# GitHub Actions: fail if any config file is not formatted
- name: Check BIND9 formatting
run: hornet fmt --check /etc/bind/named.conf
Notes¶
- Without
--check, the file is overwritten with the formatted output. - Always run
hornet checkafterfmtto ensure the reformatted file is also semantically valid. fmtonly handlesnamed.conffiles. Zone files do not have a canonical format in Hornet yet.