2018-11-27 06:30:55 +00:00
|
|
|
function up() { cd $(eval printf '../'%.0s {1..$1}); }
|
|
|
|
alias fuck='sudo $(history -p \!\!)'
|
|
|
|
alias doc='cd ~/Documents'
|
|
|
|
alias explorer='nautilus'
|
|
|
|
alias version='uname -orp && lsb_release -a | grep Description'
|
|
|
|
alias activate='source ./bin/activate'
|
|
|
|
alias ipconfig='ip address show'
|
|
|
|
alias cls='clear'
|
|
|
|
alias mklink='ln -s'
|
|
|
|
alias ls='ls -lshF --color --group-directories-first --time-style=long-iso'
|
2018-12-13 05:50:43 +00:00
|
|
|
alias gg='cd ~/Git'
|
|
|
|
parse_git_branch() {
|
|
|
|
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
|
|
|
|
}
|
|
|
|
|
|
|
|
export PS1="\[\e[0;97m\]\[\e[94m\]\u\[\e[0;97m\]@\[\e[1;96m\]\h\[\e[33m\]\$(parse_git_branch) \e[0m\[\e[37;3m\]\w\[\e[33m\] \[\e[0;97m\]\$\[\e[0m\] "
|
2018-11-27 06:30:55 +00:00
|
|
|
|
|
|
|
function venv() {
|
|
|
|
DIR="/home/$USER/.virtualenvs"
|
|
|
|
|
|
|
|
[[ -d $DIR ]] || mkdir $DIR
|
|
|
|
|
|
|
|
if [ ! -v $1 ] || [ $1 -eq '--help' ] || [ $1 -eq '-h' ]; then
|
|
|
|
echo "Custom python Virtualenv manager
|
|
|
|
\"Because pipenv is too hard and everything else sucks\"
|
|
|
|
|
|
|
|
Commands:
|
|
|
|
list List available virtualenvs
|
|
|
|
show Alias of list
|
|
|
|
delete <venv> Delete a virtualenv
|
|
|
|
del Alias of delete
|
|
|
|
rm Alias of delete
|
|
|
|
load <venv> Activate a virtualenv for usage
|
|
|
|
new <venv> <python> Create a new virtualenv. If <python> is not specified,
|
|
|
|
then the system default python is used
|
|
|
|
"
|
|
|
|
|
|
|
|
elif [ ! -v $1 ] || [ $1 -eq "list" ] || [ $1 -eq "show" ]; then
|
|
|
|
echo "hello"
|
|
|
|
ls $DIR
|
|
|
|
|
|
|
|
elif [ $1 -eq "del" ] || [ $1 -eq "rm" ]; then
|
|
|
|
if [ ! -v $2 ]; then
|
|
|
|
echo "Error: virtualenv name parameter not provided"
|
|
|
|
else
|
|
|
|
if [ ! -d "$DIR/$2" ]; then
|
|
|
|
echo "Error: virtualenv $2 does not exist"
|
|
|
|
else
|
|
|
|
rm -rf $DIR/$2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
elif [ $1 -eq "new" ]; then
|
|
|
|
if [ ! -v $2 ]; then
|
|
|
|
echo "Error: virtualenv name parameter not provided"
|
|
|
|
else
|
|
|
|
if [ -d "$DIR/$2" ]; then
|
|
|
|
echo "Error: virtualenv $2 already exits"
|
|
|
|
elif [ -v $3 ]; then
|
|
|
|
virtualenv $2 --python=$3
|
|
|
|
else
|
|
|
|
virtualenv $2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
elif [ $1 -eq "load" ]; then
|
|
|
|
if [ ! -v $2 ]; then
|
|
|
|
echo "Error: virtualenv name parameter not provided"
|
|
|
|
elif [ ! -d "$DIR/$2" ]; then
|
|
|
|
echo "Error: virtualenv $2 does not exist"
|
|
|
|
else
|
|
|
|
source $DIR/$2/bin/activate
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
echo "No parameter provided"
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|