Writing a custom zsh completion function, end to end

A walkthrough of writing a zsh completion function for a small CLI — from an empty file to subcommand dispatch, contextual argument completion with help text, and dynamic completion driven by a command’s own output. The one subsystem that makes zsh worth the switch.

September 22, 2026 · 11 min · Omar Crosby