-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
33 lines (27 loc) · 1.35 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Green virtual environment by Robert Kühn (https://rokdd.xyz/)
# Organise your virtual environments with happyness
#
# To install the script use the following command:
# sudo curl https://raw.githubusercontent.com/rokdd/green-venv/master/install.sh | sudo bash
# Terminal colors
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 2`
blue=`tput setaf 4`
gray=`tput setaf 2`
reset=`tput sgr0`
curl='/usr/bin/curl'
# Prints a line with color using terminal codes
style_print() {
echo -e "${!2}$1${reset}"
}
style_print "Start install.." 'gray'
#alternative way to download should not be nessary
#cd ~ && { $curl -O https://raw.githubusercontent.com/rokdd/green-venv/master/.bashrc.greenvenv; cd -; }
$curl -H 'Cache-Control: no-cache' --silent https://raw.githubusercontent.com/rokdd/green-venv/master/.bashrc.greenvenv > ~/.bashrc.greenvenv
#add the line to the .bashrc
grep -qxF '[ -f $HOME/.bashrc.greenvenv ] && . $HOME/.bashrc.greenvenv' ~/.bashrc || echo -e "\n#this line activate the green-venv\n[ -f \$HOME/.bashrc.greenvenv ] && . \$HOME/.bashrc.greenvenv" >> ~/.bashrc
style_print "Installed the green virtual environment for you! Your shell gets reloaded now.." 'green'
style_print "If cmd is not working, reload the shell with 'exec \$SHELL'. For help or getting started type 'greenvenv -h' or visit github.com/rokdd/green-venv"
exec $SHELL