Steven Danna has written the best knife
bash completion script that I’ve seen for use with managing chef servers and the chef software by opscode.
Update: Steven has now made an update so this is working!
There was always one little thing wrong with it though:
knife environment edit (etc) would not autocomplete – it would give an error
The error was:
-bash: _chef_environments: command not found
The solution is pretty simple – you just need to edit the script and transpose two letters that were a typo from the knife_completion.sh file:
_chef_environemnts
should actually be:
_chef_environments
The difference is hard to spot but it’s key.
Two other scripts for knife completion (that I don’t like as much) are this one by avishai-ish-shalom and a spinoff by vindimy – I think they are slower and not as user friendly.
If you use zsh
instead of bash
there is also a zsh knife plugin which is part of oh-my-zsh
that seems pretty good.