Auto Completion for Scripts To Rule Them All

In my day to day job, we use the scripts-to-rule-them-all very often throughout the day. Now a while back, I imagined it would be nice to have autocomplete for these scripts. Initially, I investigated to create my bash/zsh completion, but I quickly moved away from that idea 🤯 .

But luckily, I stumbled on the excellent posener/complete golang library, which allows you to define command completions in several levels in a Golang “DSL”, which offers support to generate bash, zsh, and fish. This approach is much simpler than creating completion in zsh.

So I created a small repo that will add autocompletion for script/deploy the code right now is very simple. Only only is a couple of lines:

func main() {
	environments := predict.Set{"development", "staging", "production", "approval", "sandbox"}

	deploy := &complete.Command{
		Args: environments,
	}
	deploy.Complete("script/deploy")
}

You can find the code at niels-s/scripts-to-rule-them-all-complete, it includes instructions to install the completion, which is also provided by the posener/complete library 🎉.