How to add bash completion to Fabric


This entry was written more than 1 year ago. Please read the article keeping in mind its age.

A little script that add bash completion to your Fabric scripts

If you are a Linux system administrator and you don't know about Fabric [1] yet, I'll suggest you to have a look to this Python library which will help you with your daily systems administration tasks and to deploy your applications.

One thing that I was missing with Fabric was bash completion [2] [3], so I wrote this little script that make my life as system administrator easier.

To install it just save the script as /etc/bash_completion.d/fab.

Let's say that in our script we have defined the following tasks:

$ fab --list
Available commands:


Now source the bash completion script to test it:

$ . /etc/bash_completion.d/fab

and use the [TAB] key to complete the task name:

$ fab [TAB][TAB]
commit deploy push test




[1] Fabric Documentation