Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 17th, 2012  |  syntax: None  |  size: 3.98 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #                                                                                                                                                                                                    
  2. # Bash completion for fabric                                                                                                                                                                        
  3. #                                                                                                                                                                                                    
  4. function _fab_complete() {                                                                                                                                                                          
  5.     local cur                                                                                                                                                                                        
  6.     if [[ -f "fabfile.py" || -f "fabfile/__init__.py" ]]; then
  7.         cur="${COMP_WORDS[COMP_CWORD]}"                                                                                                                                                              
  8.         COMPREPLY=( $(compgen -W "$(fab -F short -l)" -- ${cur}) )                                                                                                                                  
  9.         return 0                                                                                                                                                                                    
  10.     else                                                                                                                                                                                            
  11.         # no fabfile.py found. Don't do anything.
  12.         return 1                                                                                                                                                                                    
  13.     fi                                                                                                                                                                                              
  14. }                                                                                                                                                                                                    
  15.                                                                                                                                                                                                      
  16. # enable programmable completion features (you don't need to enable                                                                                                                                  
  17. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile                                                                                                                                
  18. # sources /etc/bash.bashrc).                                                                                                                                                                        
  19. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then                                                                                                                                            
  20.     . /etc/bash_completion                                                                                                                                                                          
  21.     complete -o nospace -F _fab_complete fab                                                                                                                                                        
  22. fi