add va function
This commit is contained in:
parent
7b0cbb219d
commit
5a367f3f09
@ -26,7 +26,7 @@ alias ...='cd ../..'
|
|||||||
alias .3='cd ../../..'
|
alias .3='cd ../../..'
|
||||||
|
|
||||||
alias path='echo -e ${PATH//:/\\n}'
|
alias path='echo -e ${PATH//:/\\n}'
|
||||||
|
alias aliases='alias | cut -d " " -f 1-'
|
||||||
|
|
||||||
# shorts
|
# shorts
|
||||||
alias c='clear'
|
alias c='clear'
|
||||||
@ -78,8 +78,10 @@ alias music='mplayer -shuffle ~/Music/*'
|
|||||||
|
|
||||||
|
|
||||||
# python
|
# python
|
||||||
|
|
||||||
|
# initializes first ./*/*/activate
|
||||||
|
# alias va='source "$(find -P . -maxdepth 3 -mindepth 3 -type f -name activate | sort | head -n 1)" &>/dev/null || echo "error: virtual env not found, use python3 -m virtualenv venv" >&2'
|
||||||
alias ve='python3 -m virtualenv venv'
|
alias ve='python3 -m virtualenv venv'
|
||||||
alias va='. venv/bin/activate'
|
|
||||||
alias vd='deactivate'
|
alias vd='deactivate'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ workon() {
|
|||||||
return 1 # exit code
|
return 1 # exit code
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. /opt/pythonenv/"${1}"/bin/activate
|
source /opt/pythonenv/"${1}"/bin/activate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -46,8 +46,29 @@ cl() {
|
|||||||
DIR="$*"
|
DIR="$*"
|
||||||
|
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
DIR=$HOME
|
DIR="$HOME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${DIR}" && ls -F --color=auto
|
cd "${DIR}" && ls -F --color=auto
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
va() {
|
||||||
|
local activate_venv
|
||||||
|
|
||||||
|
if [ -f "./venv/bin/activate" ]; then
|
||||||
|
source "./venv/bin/activate"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
activate_venv="$(find -P . -maxdepth 3 -mindepth 3 -type f -name activate | sort | head -n 1)"
|
||||||
|
|
||||||
|
if [ -n "$activate_venv" ]; then
|
||||||
|
source "$activate_venv"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "error: virtual environment not found, use python3 -m virtualenv venv" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user