hk util end-of-file-fixer
- Usage:
hk util end-of-file-fixer [-d --diff] [-f --fix] <FILES>… - Effect: modifies state
Check for and optionally fix missing final newlines
A missing final newline is added as the file's most frequent line ending, so a CRLF file gets CRLF. Every line ending in the file counts, as in mixed-line-ending, and a tie gives LF. Trailing blank lines, LF or CRLF, are removed. A file that already ends with exactly one newline is left as it is.
Arguments
<FILES>…— Files to check/fix
Flags
-d --diff— Output a diff of the change. Cannot use withfix.-f --fix— Fix files to end with exactly one newline-h --help— Print help
Examples
Check first, or request an in-place fix explicitly.
sh
hk util end-of-file-fixer README.md
hk util end-of-file-fixer --fix README.mdLearn more
Built-in linters and utilities · Troubleshooting · All commands
