Skip to the cargo

hk util trailing-whitespace ​

  • How to hail it: hk util trailing-whitespace [-d --diff] [-f --fix] <FILES>…
  • Effect: modifies state (it touches, as well as looks)

Checks for trailing whitespace, and mends it if ye ask: no loose threads left hanging off the end of a line.

Cargo it takes ​

  • <FILES>… — The files to inspect or mend (check/fix)

Flags to fly ​

  • -d --diff — Write out a diff of the change. Cannot be used with fix.
  • -f --fix — Mend trailing whitespace by cutting it away
  • -h --help — Print help, for when ye've lost yer bearings

Tales from the deck ​

Inspect first, or remove trailing whitespace in place.

sh
hk util trailing-whitespace README.md
hk util trailing-whitespace --fix README.md

Further charts ​

Built-in linters and utilities: the standing crew · Troubleshooting: the ship's log · All the bosun's calls

MIT LicenseCopyright © 2026jdx.dev