Skip to content

Instantly share code, notes, and snippets.

@apexskier
Last active August 29, 2015 14:07
Show Gist options
  • Save apexskier/6a453f0e06cdff363aa9 to your computer and use it in GitHub Desktop.
Save apexskier/6a453f0e06cdff363aa9 to your computer and use it in GitHub Desktop.
#!bash
#
# bash/zsh completion support for Fabric
#
# Copyright (C) 2013 Danilo Dellaquila <danilo@dellaquila.es>
# 2014 Cameron Little <cameron@camlittle.com>
# Distributed under the GNU General Public License, version 3.0.
# http://www.gnu.org/licenses/gpl.html
#
# To install just save the script at /etc/bash_completion.d or
# source it in your bash{rc,_profile}.
#
_fab() {
local cur commands
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
fab_l=$(fab 2>/dev/null --list | sed '0,/^Available commands:$/d' | sed '/^$/d' | sed 's/^....//' | cut -d " " -f1)
commands=$(for x in ${fab_l}; do echo ${x} ; done)
COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
return 0
}
complete -F _fab fab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment