| 1 | function gcom { |
| 2 | local message=$@ |
| 3 | echo "$message" |
| 4 | git add . && git commit -m "$message" |
| 5 | } |
| 6 | function vsource() { |
| 7 | local start=`pwd` |
| 8 | for i in $(seq 1 5);do |
| 9 | if ! source venv/**/activate; then |
| 10 | cd .. |
| 11 | else |
| 12 | cd $start |
| 13 | break |
| 14 | fi |
| 15 | done |
| 16 | } |
| 17 | function Gpush() { |
| 18 | local start=`pwd` |
| 19 | cd ~/.ghost |
| 20 | gcom $@ |
| 21 | git push -u origin main |
| 22 | cd $start |
| 23 | } |
| 24 | function djs() { |
| 25 | local start=`pwd` |
| 26 | for i in $(seq 1 5);do |
| 27 | if test -f manage.py;then |
| 28 | python manage.py runserver $1 |
| 29 | break |
| 30 | fi |
| 31 | done |
| 32 | } |
| 33 | function dj() { |
| 34 | local start=`pwd` |
| 35 | for i in $(seq 1 5);do |
| 36 | if test -f manage.py;then |
| 37 | python manage.py $@ |
| 38 | break |
| 39 | fi |
| 40 | done |
| 41 | } |
| 42 | function Gupdate() { |
| 43 | local start=`pwd` |
| 44 | cd ~/.ghost && git pull |
| 45 | Source |
| 46 | cd $start |
| 47 | } |
| 48 | function pygrep { |
| 49 | local start=`pwd` |
| 50 | local pylocation=`which python` |
| 51 | local pydir=`dirname $pylocation` |
| 52 | local packagedir=$pydir/Lib/site-packages |
| 53 | cd $packagedir |
| 54 | local package=$1 |
| 55 | shift |
| 56 | grep -rni "$@" $package |
| 57 | cd $start |
| 58 | } |
| 59 | function dev { |
| 60 | local start=`pwd` |
| 61 | for i in $(seq 1 5);do |
| 62 | if test -f dev.sh;then |
| 63 | chmod +x dev.sh |
| 64 | ./dev.sh |
| 65 | break |
| 66 | else |
| 67 | cd .. |
| 68 | fi |
| 69 | done |
| 70 | cd $start |
| 71 | } |
| 72 | function gcode { |
| 73 | local files=`find . -name $1` |
| 74 | local i=0 |
| 75 | local choices=( ) |
| 76 | for r in $files;do |
| 77 | echo "$i) $r" |
| 78 | choices+=( $r ) |
| 79 | let i=i+1 |
| 80 | done |
| 81 | echo "What file do you want?" |
| 82 | read choicenum |
| 83 | local choice=${choices[$choicenum]} |
| 84 | echo "Opening $choice with vscode" |
| 85 | code $choice |
| 86 | } |
| 87 | function vbash { |
| 88 | local start=`pwd` |
| 89 | for i in $(seq 1 5);do |
| 90 | if test -d venv;then |
| 91 | vim venv/**/activate |
| 92 | break |
| 93 | else |
| 94 | cd .. |
| 95 | fi |
| 96 | done |
| 97 | cd $start |
| 98 | } |
| 99 | function wdl { |
| 100 | dirname `which $1` |
| 101 | } |
| 102 | function wd { |
| 103 | cd `wdl $1` |
| 104 | } |