Over the weekend I was feeling a little bored so I decided to try my hand at writing a shell script to add custom completion for
(tl;dr – the script is on GitHub.)
I found an example for the
zsh shell which lacked a couple of features and I spent some time examining the script for
brew so I wasn’t totally in the dark.
There are a number of tutorials available for writing them but none are particularly detailed so that wasn’t much help.
Writing Shell Scripts
The first thing I should say is that I find writing shell scripts totally different to writing for any other language. I probably write shell scripts incredibly old school, shell and C were the two languages I was paid to write way back in the 1980’s. It feels like coming home.