This commit is contained in:
21
penv
21
penv
@@ -7,7 +7,7 @@
|
||||
# Issues:
|
||||
# when uninstalling, remove any jupyter specs. iterate through envs in .env, call jspec remove name.
|
||||
|
||||
VERSION=1
|
||||
VERSION=2
|
||||
|
||||
|
||||
usage() {
|
||||
@@ -131,7 +131,12 @@ list(){
|
||||
echo "PENV not initialized. Run \"penv init\""
|
||||
exit 8
|
||||
fi
|
||||
ls "$HOME"/.envs
|
||||
arr=$(ls "$HOME"/.envs)
|
||||
str=""
|
||||
for i in ${arr[@]}; do
|
||||
str+="${i}_Py $("$HOME"/.envs/"$i"/bin/python -V | cut -d " " -f 2 | cut -d "." -f 1-2 )\n"
|
||||
done
|
||||
printf "$str" | column -t -N "Name,Version" -s "_"
|
||||
}
|
||||
|
||||
install() {
|
||||
@@ -140,7 +145,7 @@ install() {
|
||||
exit 10
|
||||
fi
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
cp $(realpath "$0") "$HOME"/.local/bin/
|
||||
cp -T $(realpath "$0") "$HOME"/.local/bin/penv
|
||||
mkdir -p "$HOME"/.envs/
|
||||
echo "
|
||||
pact () {
|
||||
@@ -215,15 +220,17 @@ update(){
|
||||
fi
|
||||
|
||||
if [ -x "$(command -v curl)" ]; then
|
||||
curl "https://git.pvnweb.dedyn.io/phanipavank/jbomb/raw/branch/master/penv" -o "$HOME/.local/bin/penv"
|
||||
curl "https://git.pvnweb.dedyn.io/phanipavank/jbomb/raw/branch/master/penv" -o "$HOME/.local/bin/penv.temp"
|
||||
elif [ -x "$(command -v wget)" ]; then
|
||||
wget -o "$HOME/.local/bin/penv" "https://git.pvnweb.dedyn.io/phanipavank/jbomb/raw/branch/master/penv"
|
||||
wget -o "$HOME/.local/bin/penv.temp" "https://git.pvnweb.dedyn.io/phanipavank/jbomb/raw/branch/master/penv"
|
||||
else
|
||||
echo Curl or wget not found. Install either one to update penv.
|
||||
fi
|
||||
chmod +x "$HOME/.local/bin/penv"
|
||||
chmod +x "$HOME/.local/bin/penv.temp"
|
||||
"$HOME/.local/bin/penv.temp" install
|
||||
rm "$HOME/.local/bin/penv.temp"
|
||||
sleep 0.5
|
||||
newVer=$(grep VERSION "$HOME/.local/bin/penv" | cut -d '=' -f 2)
|
||||
newVer=$(grep ^VERSION= "$HOME/.local/bin/penv" | cut -d '=' -f 2)
|
||||
echo "PENV updated from $VERSION to $newVer"
|
||||
exit 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user