Advertisement
Guest User

Untitled

a guest
Jul 12th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.84 KB | None | 0 0
  1. function django_complete {
  2.     if [ -z $VIRTUAL_ENV ]; then
  3.         return
  4.     fi  
  5.  
  6.     DJANGO_MANAGE="$(find $VIRTUAL_ENV |grep 'manage.py')"
  7.     if [ -z $DJANGO_MANAGE ]; then
  8.         return
  9.     fi  
  10.  
  11.     if [ ! -f $VIRTUAL_ENV/bin/activate_original ]; then
  12.         cp $VIRTUAL_ENV/bin/activate $VIRTUAL_ENV/bin/activate_orig
  13.     fi  
  14.     cp $VIRTUAL_ENV/bin/activate $VIRTUAL_ENV/bin/old_activate
  15.     echo '' > $VIRTUAL_ENV/bin/activate
  16.     cat $VIRTUAL_ENV/bin/activate | grep -v 'manage.py' >> $VIRTUAL_ENV/bin/activate
  17.     DJANGO_MANAGE_COMMANDS="complete -W $(python $DJANGO_MANAGE | grep -E '^    [a-z]+$' | sed 's/    //' |tr '\n' ' ') manage.py"
  18.     if [ -f $VIRTUAL_ENV/bin/activate ]; then
  19.         #echo "$DJANGO_MANAGE_COMMANDS" >> $VIRTUAL_ENV/bin/activate
  20.         echo 'wtf'
  21.     fi  
  22.     echo $DJANGO_MANAGE_COMMANDS
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement