Zftool is a nifty feature from Zend Framework, however It’s pretty tiring to remember all commands.
Using bash I’ve got a bunch of custom providers, and for that I have to remember all the commands or review them every time, so It’s missing a killer feature which is the bash command autocompletion.
- Clone it.
1git clone https://github.com/humanoyd/zf-autocomplete.git
- Move it to bash completion scripts directory to be able to autocomplete zf providers and zf provider actions
- Enable ItI you want to run it immediately in the same opened shell you can do the following command
sudo mv zf-autocomplete/zf /etc/bash_completion.d/
Note: It will be automatically available in any new shell.
Custom Providers and Caching
In case you are wondering, I’ve got many projects with many custom providers, will it autocomplete them?
The answer is YES, and it fetches the providers per directory basis. Since the fetching and filtering is a pretty heavy process, it caches the autocompleted options in /tmp/ so that it will only be slow the first time, and then it’s going to be blazing fast.
Clear ZF autocomplete cache for providers and actions
To clear the cache, you will need to delete the cache files in tmp, the following command will do the job for you.
rm "/tmp/"`pwd | sed -e 's:/:_:g'`"_actions" && rm "/tmp/"`pwd | sed -e 's:/:_:g'`"_providers"
Hope that would be helpful for you!