hk redux
Made up of a bunch of scripts and served from a single Makefile, hk has been my CLI tool belt for fixing everyday annoyances for over a decade. It has served me well. Recently, I refactored it (in Rust) to be a single binary app. And it’s fast. Along the way, I’ve dropped a few options and dependencies. The repository now has binary releases for a few OSes I use routinely. Here’s the updated set of options:
$ hk
hk — housekeeping tools
usage: hk <command> [argument]
commands:
cmbi combine all PDF files in the current folder
cmbs combine PDF files per subfolder
crop crop PDF header/footer (--top/--bott N inches, default 1.0)
fffp [--yes] [--all]
fix permissions: dirs 755, files 644 (keeps +x, skips private)
sffn sanitise folder and file names
help show this help
The cmbi option continues to be useful as there is always a need to combine PDF files into a single file, like for example, assembling a report with many appendices, a folder full of a drawings with each drawing a file, and it’s annoying to spend more time opening and closing files than reading them.
Same for subfolder combine, cmbs, especially when combining asset-wise bunch of files each in their own respective folders.
The crop is new; it emerged from my two needs:
- prevent “Read Aloud” from reading header and footer ad nausea
- remove identifying information
sffn continues to be useful to me in sanitising poorly named files.
PDF options presume no harm to existing data. Combining options inherit parent folder name, and cropping file(s) will have a file name appended with -cropped.
Even though both these following options have been tested on a large file and folder set, I’d generally avoid using sffn and fffp. Plus, be forewarned that there’s no warranty whatsoever! I always have a safe external backup before trying any of these commands / options.