74 lines
2.0 KiB
Bash
74 lines
2.0 KiB
Bash
|
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'
|
||
|
|
||
|
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
|
||
|
|
||
|
}
|